diff options
author | Rich Trott <rtrott@gmail.com> | 2019-06-14 21:01:18 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-06-16 21:20:06 -0700 |
commit | 215fd083ea5c028f6c1929a5ff58965bb9af1f59 (patch) | |
tree | 3dda9bd2342c0203c2eacba1b10e01e4f1c94c3e /doc | |
parent | b456bbcc6d0598ed3a8fa5edd05d5d71b372eab7 (diff) | |
download | android-node-v8-215fd083ea5c028f6c1929a5ff58965bb9af1f59.tar.gz android-node-v8-215fd083ea5c028f6c1929a5ff58965bb9af1f59.tar.bz2 android-node-v8-215fd083ea5c028f6c1929a5ff58965bb9af1f59.zip |
doc: improve assert strict-mode text
Simplify and clarify introductory material on `strict` mode.
Merge two single-sentence paragraphs into a single paragraph.
Replace "`strict mode`" with "`strict` mode".
PR-URL: https://github.com/nodejs/node/pull/28239
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/assert.md | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/doc/api/assert.md b/doc/api/assert.md index 16aa242ec0..15a8739e83 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -5,10 +5,8 @@ > Stability: 2 - Stable The `assert` module provides a simple set of assertion tests that can be used to -test invariants. - -A `strict` and a `legacy` mode exist, while it is recommended to only use -[`strict mode`][]. +test invariants. The module provides a recommended [`strict` mode][] and a more +lenient `legacy` mode. For more information about the used equality comparisons see [MDN's guide on equality comparisons and sameness][mdn-equality-guide]. @@ -89,7 +87,7 @@ changes: description: Added strict mode to the assert module. --> -When using the `strict mode`, any `assert` function will use the equality used +When using the `strict` mode, any `assert` function will use the equality used in the strict function mode. So [`assert.deepEqual()`][] will, for example, work the same as [`assert.deepStrictEqual()`][]. @@ -140,7 +138,7 @@ It can be accessed using: const assert = require('assert'); ``` -It is recommended to use the [`strict mode`][] instead as the +It is recommended to use the [`strict` mode][] instead as the [Abstract Equality Comparison][] can often have surprising results. This is especially true for [`assert.deepEqual()`][], where the comparison rules are lax: @@ -1288,7 +1286,7 @@ second argument. This might lead to difficult-to-spot errors. [`assert.ok()`]: #assert_assert_ok_value_message [`assert.strictEqual()`]: #assert_assert_strictequal_actual_expected_message [`assert.throws()`]: #assert_assert_throws_fn_error_message -[`strict mode`]: #assert_strict_mode +[`strict` mode]: #assert_strict_mode [Abstract Equality Comparison]: https://tc39.github.io/ecma262/#sec-abstract-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 |