Skip to content

Commit

Permalink
doc: improve assert strict-mode text
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and targos committed Jun 18, 2019
1 parent 7cf79fa commit 6015627
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down Expand Up @@ -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()`][].

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6015627

Please sign in to comment.