From ce1edd3cfc919b866f636e9ec16ef72d769ea849 Mon Sep 17 00:00:00 2001 From: Shobhit Chittora Date: Thu, 14 Nov 2019 17:37:11 +0530 Subject: [PATCH 1/3] doc: adds assert doc for strict mode with pointer to strict equality Refs: https://github.com/nodejs/node/issues/30485 --- doc/api/assert.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index 7df70f60c35952..1abc23f1bd71aa 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -82,7 +82,9 @@ changes: In `strict` mode, `assert` functions use the comparison in the corresponding strict functions. For example, [`assert.deepEqual()`][] will behave like -[`assert.deepStrictEqual()`][]. +[`assert.deepStrictEqual()`][]. This uses the [Strict Equality Comparison][] +from the ECMAScript spec and does not refer to JavaScript strict mode (`"use strict";`) +in any way. In `strict` mode, error messages for objects display a diff. In legacy mode, error messages for objects display the objects, often truncated. @@ -1319,6 +1321,7 @@ second argument. This might lead to difficult-to-spot errors. [`assert.throws()`]: #assert_assert_throws_fn_error_message [`strict` mode]: #assert_strict_mode [Abstract Equality Comparison]: https://tc39.github.io/ecma262/#sec-abstract-equality-comparison +[Strict Equality Comparison]: https://tc39.es/ecma262/#sec-strict-equality-comparison [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 From ae19fe1ceba3054df7d6d3dde5c5f5a2e40025c4 Mon Sep 17 00:00:00 2001 From: Shobhit Chittora Date: Thu, 14 Nov 2019 17:41:20 +0530 Subject: [PATCH 2/3] doc: fix lint issue for max line length --- doc/api/assert.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index 1abc23f1bd71aa..d4ffa4a79f5291 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -83,8 +83,8 @@ changes: In `strict` mode, `assert` functions use the comparison in the corresponding strict functions. For example, [`assert.deepEqual()`][] will behave like [`assert.deepStrictEqual()`][]. This uses the [Strict Equality Comparison][] -from the ECMAScript spec and does not refer to JavaScript strict mode (`"use strict";`) -in any way. +from the ECMAScript spec and does not refer to JavaScript strict +mode (`"use strict";`) in any way. In `strict` mode, error messages for objects display a diff. In legacy mode, error messages for objects display the objects, often truncated. From d9098862409887df7235f2a31ee96e6de837694e Mon Sep 17 00:00:00 2001 From: Shobhit Chittora Date: Fri, 15 Nov 2019 14:03:21 +0530 Subject: [PATCH 3/3] doc: remove wrong assumption on strict --- doc/api/assert.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index d4ffa4a79f5291..03fa4e5381cb12 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -80,11 +80,9 @@ changes: description: Added strict mode to the assert module. --> -In `strict` mode, `assert` functions use the comparison in the corresponding -strict functions. For example, [`assert.deepEqual()`][] will behave like -[`assert.deepStrictEqual()`][]. This uses the [Strict Equality Comparison][] -from the ECMAScript spec and does not refer to JavaScript strict -mode (`"use strict";`) in any way. +In `strict` mode (not to be confused with `"use strict"`), `assert` functions +use the comparison in the corresponding strict functions. For example, +[`assert.deepEqual()`][] will behave like [`assert.deepStrictEqual()`][]. In `strict` mode, error messages for objects display a diff. In legacy mode, error messages for objects display the objects, often truncated. @@ -1321,7 +1319,6 @@ second argument. This might lead to difficult-to-spot errors. [`assert.throws()`]: #assert_assert_throws_fn_error_message [`strict` mode]: #assert_strict_mode [Abstract Equality Comparison]: https://tc39.github.io/ecma262/#sec-abstract-equality-comparison -[Strict Equality Comparison]: https://tc39.es/ecma262/#sec-strict-equality-comparison [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