mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
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>
This commit is contained in:
1 parent
b456bbcc6d
commit
215fd083ea
1 file changed
+5
-7
+5
-7
@@ -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
|
||||
|
||||
Reference in new issue
Block a user