Skip to content

Commit 5b7b18d

Browse files
TrottBridgeAR
authored andcommitted
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: #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>
1 parent 47dc5b2 commit 5b7b18d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

doc/api/assert.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
> Stability: 2 - Stable
66
77
The `assert` module provides a simple set of assertion tests that can be used to
8-
test invariants.
9-
10-
A `strict` and a `legacy` mode exist, while it is recommended to only use
11-
[`strict mode`][].
8+
test invariants. The module provides a recommended [`strict` mode][] and a more
9+
lenient `legacy` mode.
1210

1311
For more information about the used equality comparisons see
1412
[MDN's guide on equality comparisons and sameness][mdn-equality-guide].
@@ -89,7 +87,7 @@ changes:
8987
description: Added strict mode to the assert module.
9088
-->
9189

92-
When using the `strict mode`, any `assert` function will use the equality used
90+
When using the `strict` mode, any `assert` function will use the equality used
9391
in the strict function mode. So [`assert.deepEqual()`][] will, for example,
9492
work the same as [`assert.deepStrictEqual()`][].
9593

@@ -140,7 +138,7 @@ It can be accessed using:
140138
const assert = require('assert');
141139
```
142140

143-
It is recommended to use the [`strict mode`][] instead as the
141+
It is recommended to use the [`strict` mode][] instead as the
144142
[Abstract Equality Comparison][] can often have surprising results. This is
145143
especially true for [`assert.deepEqual()`][], where the comparison rules are
146144
lax:
@@ -1288,7 +1286,7 @@ second argument. This might lead to difficult-to-spot errors.
12881286
[`assert.ok()`]: #assert_assert_ok_value_message
12891287
[`assert.strictEqual()`]: #assert_assert_strictequal_actual_expected_message
12901288
[`assert.throws()`]: #assert_assert_throws_fn_error_message
1291-
[`strict mode`]: #assert_strict_mode
1289+
[`strict` mode]: #assert_strict_mode
12921290
[Abstract Equality Comparison]: https://tc39.github.io/ecma262/#sec-abstract-equality-comparison
12931291
[Object wrappers]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive#Primitive_wrapper_objects_in_JavaScript
12941292
[Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring

0 commit comments

Comments
 (0)