From e425f369ea6ef5e638d9e42489abd9b4b8e1aab3 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 12 Jan 2022 22:17:05 -0800 Subject: [PATCH] doc: remove SameValue comparison reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Referring to `Object.is()` will be more clear and direct. The `Object.is()` reference in turn refers to `SameValue` so people can dig deeper there if they want or need to. PR-URL: https://github.com/nodejs/node/pull/41460 Reviewed-By: Luigi Pinca Reviewed-By: Tobias Nießen Reviewed-By: Anna Henningsen Reviewed-By: Harshitha K P --- doc/api/assert.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index b16b12a1a40569..11ee21c0ea2d11 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -676,8 +676,7 @@ are recursively evaluated also by the following rules. ### Comparison details -* Primitive values are compared using the [SameValue Comparison][], used by - [`Object.is()`][]. +* Primitive values are compared using [`Object.is()`][]. * [Type tags][Object.prototype.toString()] of objects should be the same. * [`[[Prototype]]`][prototype-spec] of objects are compared using the [`===` operator][]. @@ -729,7 +728,7 @@ assert.deepStrictEqual(date, fakeDate); // - Date {} assert.deepStrictEqual(NaN, NaN); -// OK, because of the SameValue comparison +// OK because Object.is(NaN, NaN) is true. // Different unwrapped numbers: assert.deepStrictEqual(new Number(1), new Number(2)); @@ -745,7 +744,7 @@ assert.deepStrictEqual(new String('foo'), Object('foo')); assert.deepStrictEqual(-0, -0); // OK -// Different zeros using the SameValue Comparison: +// Different zeros: assert.deepStrictEqual(0, -0); // AssertionError: Expected inputs to be strictly deep-equal: // + actual - expected @@ -821,7 +820,7 @@ assert.deepStrictEqual(date, fakeDate); // - Date {} assert.deepStrictEqual(NaN, NaN); -// OK, because of the SameValue comparison +// OK because Object.is(NaN, NaN) is true. // Different unwrapped numbers: assert.deepStrictEqual(new Number(1), new Number(2)); @@ -837,7 +836,7 @@ assert.deepStrictEqual(new String('foo'), Object('foo')); assert.deepStrictEqual(-0, -0); // OK -// Different zeros using the SameValue Comparison: +// Different zeros: assert.deepStrictEqual(0, -0); // AssertionError: Expected inputs to be strictly deep-equal: // + actual - expected @@ -1716,7 +1715,7 @@ changes: * `message` {string|Error} Tests strict inequality between the `actual` and `expected` parameters as -determined by the [SameValue Comparison][]. +determined by [`Object.is()`][]. ```mjs import assert from 'assert/strict'; @@ -2008,7 +2007,7 @@ changes: * `message` {string|Error} Tests strict equality between the `actual` and `expected` parameters as -determined by the [SameValue Comparison][]. +determined by [`Object.is()`][]. ```mjs import assert from 'assert/strict'; @@ -2428,7 +2427,6 @@ argument. [Object wrappers]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive#Primitive_wrapper_objects_in_JavaScript [Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring -[SameValue Comparison]: https://tc39.github.io/ecma262/#sec-samevalue [`!=` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality [`===` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality [`==` operator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality