| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8973589 commit 7c9fbc1
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -278,6 +278,10 @@ An alias of [`assert.ok()`][]. | |||
| 278 | 278 | <!-- YAML | |
| 279 | 279 | added: v0.1.21 | |
| 280 | 280 | changes: | |
| 281 | + - version: REPLACEME | ||
| 282 | + pr-url: https://github.com/nodejs/node/pull/59448 | ||
| 283 | + description: Promises are not considered equal anymore if they are not of | ||
| 284 | + the same instance. | ||
| 281 | 285 | - version: REPLACEME | |
| 282 | 286 | pr-url: https://github.com/nodejs/node/pull/57627 | |
| 283 | 287 | description: Invalid dates are now considered equal. | |
@@ -366,8 +370,10 @@ are also recursively evaluated by the following rules. | |||
| 366 | 370 | * Implementation does not test the [`[[Prototype]]`][prototype-spec] of | |
| 367 | 371 | objects. | |
| 368 | 372 | * {Symbol} properties are not compared. | |
| 369 | - * {WeakMap} and {WeakSet} comparison does not rely on their values | ||
| 370 | - but only on their instances. | ||
| 373 | + * {WeakMap}, {WeakSet} and {Promise} instances are **not** compared | ||
| 374 | + structurally. They are only equal if they reference the same object. Any | ||
| 375 | + comparison between different `WeakMap`, `WeakSet`, or `Promise` instances | ||
| 376 | + will result in inequality, even if they contain the same content. | ||
| 371 | 377 | * {RegExp} lastIndex, flags, and source are always compared, even if these | |
| 372 | 378 | are not enumerable properties. | |
| 373 | 379 | ||
@@ -472,6 +478,10 @@ parameter is an instance of {Error} then it will be thrown instead of the | |||
| 472 | 478 | <!-- YAML | |
| 473 | 479 | added: v1.2.0 | |
| 474 | 480 | changes: | |
| 481 | + - version: REPLACEME | ||
| 482 | + pr-url: https://github.com/nodejs/node/pull/59448 | ||
| 483 | + description: Promises are not considered equal anymore if they are not of | ||
| 484 | + the same instance. | ||
| 475 | 485 | - version: REPLACEME | |
| 476 | 486 | pr-url: https://github.com/nodejs/node/pull/57627 | |
| 477 | 487 | description: Invalid dates are now considered equal. | |
@@ -540,10 +550,10 @@ are recursively evaluated also by the following rules. | |||
| 540 | 550 | * {Map} keys and {Set} items are compared unordered. | |
| 541 | 551 | * Recursion stops when both sides differ or either side encounters a circular | |
| 542 | 552 | reference. | |
| 543 | - * {WeakMap} and {WeakSet} instances are **not** compared structurally. | ||
| 544 | - They are only equal if they reference the same object. Any comparison between | ||
| 545 | - different `WeakMap` or `WeakSet` instances will result in inequality, | ||
| 546 | - even if they contain the same entries. | ||
| 553 | + * {WeakMap}, {WeakSet} and {Promise} instances are **not** compared | ||
| 554 | + structurally. They are only equal if they reference the same object. Any | ||
| 555 | + comparison between different `WeakMap`, `WeakSet`, or `Promise` instances | ||
| 556 | + will result in inequality, even if they contain the same content. | ||
| 547 | 557 | * {RegExp} lastIndex, flags, and source are always compared, even if these | |
| 548 | 558 | are not enumerable properties. | |
| 549 | 559 | ||
@@ -2230,6 +2240,10 @@ added: | |||
| 2230 | 2240 | - v23.4.0 | |
| 2231 | 2241 | - v22.13.0 | |
| 2232 | 2242 | changes: | |
| 2243 | + - version: REPLACEME | ||
| 2244 | + pr-url: https://github.com/nodejs/node/pull/59448 | ||
| 2245 | + description: Promises are not considered equal anymore if they are not of | ||
| 2246 | + the same instance. | ||
| 2233 | 2247 | - version: REPLACEME | |
| 2234 | 2248 | pr-url: https://github.com/nodejs/node/pull/57627 | |
| 2235 | 2249 | description: Invalid dates are now considered equal. | |
@@ -2268,10 +2282,10 @@ behaving as a super set of it. | |||
| 2268 | 2282 | * {Map} keys and {Set} items are compared unordered. | |
| 2269 | 2283 | * Recursion stops when both sides differ or both sides encounter a circular | |
| 2270 | 2284 | reference. | |
| 2271 | - * {WeakMap} and {WeakSet} instances are **not** compared structurally. | ||
| 2272 | - They are only equal if they reference the same object. Any comparison between | ||
| 2273 | - different `WeakMap` or `WeakSet` instances will result in inequality, | ||
| 2274 | - even if they contain the same entries. | ||
| 2285 | + * {WeakMap}, {WeakSet} and {Promise} instances are **not** compared | ||
| 2286 | + structurally. They are only equal if they reference the same object. Any | ||
| 2287 | + comparison between different `WeakMap`, `WeakSet`, or `Promise` instances | ||
| 2288 | + will result in inequality, even if they contain the same content. | ||
| 2275 | 2289 | * {RegExp} lastIndex, flags, and source are always compared, even if these | |
| 2276 | 2290 | are not enumerable properties. | |
| 2277 | 2291 | * Holes in sparse arrays are ignored. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -99,22 +99,23 @@ const types = require('internal/util/types'); | |||
| 99 | 99 | const { | |
| 100 | 100 | isAnyArrayBuffer, | |
| 101 | 101 | isArrayBufferView, | |
| 102 | + isBigIntObject, | ||
| 103 | + isBooleanObject, | ||
| 104 | + isBoxedPrimitive, | ||
| 105 | + isCryptoKey, | ||
| 102 | 106 | isDate, | |
| 107 | + isFloat16Array, | ||
| 108 | + isFloat32Array, | ||
| 109 | + isFloat64Array, | ||
| 110 | + isKeyObject, | ||
| 103 | 111 | isMap, | |
| 104 | - isRegExp, | ||
| 105 | - isSet, | ||
| 106 | 112 | isNativeError, | |
| 107 | - isBoxedPrimitive, | ||
| 108 | 113 | isNumberObject, | |
| 114 | + isPromise, | ||
| 115 | + isRegExp, | ||
| 116 | + isSet, | ||
| 109 | 117 | isStringObject, | |
| 110 | - isBooleanObject, | ||
| 111 | - isBigIntObject, | ||
| 112 | 118 | isSymbolObject, | |
| 113 | - isFloat16Array, | ||
| 114 | - isFloat32Array, | ||
| 115 | - isFloat64Array, | ||
| 116 | - isKeyObject, | ||
| 117 | - isCryptoKey, | ||
| 118 | 119 | isWeakMap, | |
| 119 | 120 | isWeakSet, | |
| 120 | 121 | } = types; | |
@@ -409,7 +410,7 @@ function objectComparisonStart(val1, val2, mode, memos) { | |||
| 409 | 410 | ) { | |
| 410 | 411 | return false; | |
| 411 | 412 | } | |
| 412 | - } else if (isWeakMap(val1) || isWeakSet(val1)) { | ||
| 413 | + } else if (isWeakMap(val1) || isWeakSet(val1) || isPromise(val1)) { | ||
| 413 | 414 | return false; | |
| 414 | 415 | } | |
| 415 | 416 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1633,3 +1633,10 @@ test('Inherited null prototype without own constructor properties should check t | |||
| 1633 | 1633 | assert.deepEqual(a, b); | |
| 1634 | 1634 | assert.deepEqual(b, a); | |
| 1635 | 1635 | }); | |
| 1636 | + | ||
| 1637 | + test('Promises should fail deepEqual', () => { | ||
| 1638 | + const a = Promise.resolve(1); | ||
| 1639 | + const b = Promise.resolve(1); | ||
| 1640 | + assertDeepAndStrictEqual(a, a); | ||
| 1641 | + assertNotDeepOrStrict(a, b); | ||
| 1642 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments