summaryrefslogtreecommitdiff
path: root/doc/api/util.md
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-10-05 21:27:46 -0700
committerRich Trott <rtrott@gmail.com>2017-10-25 22:30:37 -0700
commit36732084db9d0ff59b6ce31e839450cd91a156be (patch)
tree7575c31ff152a21e45129bcf837effab8c0ea15d /doc/api/util.md
parente3503aca086f3f2f9587004ac594ed83a57f7443 (diff)
downloadandroid-node-v8-36732084db9d0ff59b6ce31e839450cd91a156be.tar.gz
android-node-v8-36732084db9d0ff59b6ce31e839450cd91a156be.tar.bz2
android-node-v8-36732084db9d0ff59b6ce31e839450cd91a156be.zip
util,assert: expose util.isDeepStrictEqual()
Provide `util.isDeepStrictEqual()` that works like `assert.deepStrictEqual()` but returns a boolean rather than throwing an error. Several userland modules have needed this functionality and implemented it independently. This functionality already exists in Node.js core, so this exposes it for use by modules. Modules that have needed this functionality include `lodash`, `concordance` (used by `ava`), and `qunit`. PR-URL: https://github.com/nodejs/node/pull/16084 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'doc/api/util.md')
-rw-r--r--doc/api/util.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/api/util.md b/doc/api/util.md
index 6619ee2ad6..b13d02a8c0 100644
--- a/doc/api/util.md
+++ b/doc/api/util.md
@@ -455,6 +455,21 @@ util.inspect.defaultOptions.maxArrayLength = null;
console.log(arr); // logs the full array
```
+## util.isDeepStrictEqual(val1, val2)
+<!-- YAML
+added: REPLACEME
+-->
+
+* `val1` {any}
+* `val2` {any}
+* Returns: {string}
+
+Returns `true` if there is deep strict equality between `val` and `val2`.
+Otherwise, returns `false`.
+
+See [`assert.deepStrictEqual()`][] for more information about deep strict
+equality.
+
## util.promisify(original)
<!-- YAML
added: v8.0.0
@@ -1187,6 +1202,7 @@ Deprecated predecessor of `console.log`.
[`Buffer.isBuffer()`]: buffer.html#buffer_class_method_buffer_isbuffer_obj
[`Error`]: errors.html#errors_class_error
[`Object.assign()`]: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
+[`assert.deepStrictEqual()`]: assert.html#assert_assert_deepstrictequal_actual_expected_message
[`console.error()`]: console.html#console_console_error_data_args
[`console.log()`]: console.html#console_console_log_data_args
[`util.inspect()`]: #util_util_inspect_object_options