summaryrefslogtreecommitdiff
path: root/lib/assert.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2017-08-19 02:54:49 -0300
committerRuben Bridgewater <ruben@bridgewater.de>2017-09-05 08:15:33 -0300
commitea2e6363f221c1c6ca5b04b295bd6d17ecca355b (patch)
tree024b70a056fbf82c44da37f6b51175a68a1d6867 /lib/assert.js
parent1789dcfc873eea0b993a1fa20f2e30819a57b9c9 (diff)
downloadandroid-node-v8-ea2e6363f221c1c6ca5b04b295bd6d17ecca355b.tar.gz
android-node-v8-ea2e6363f221c1c6ca5b04b295bd6d17ecca355b.tar.bz2
android-node-v8-ea2e6363f221c1c6ca5b04b295bd6d17ecca355b.zip
assert: use SameValueZero in deepStrictEqual
Comparing NaN will not throw anymore. PR-URL: https://github.com/nodejs/node/pull/15036 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib/assert.js')
-rw-r--r--lib/assert.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/assert.js b/lib/assert.js
index 7ba7ebadf1..2c52fcc199 100644
--- a/lib/assert.js
+++ b/lib/assert.js
@@ -167,8 +167,11 @@ function isObjectOrArrayTag(tag) {
// a) The same built-in type tags
// b) The same prototypes.
function strictDeepEqual(actual, expected) {
- if (actual === null || expected === null ||
- typeof actual !== 'object' || typeof expected !== 'object') {
+ if (typeof actual !== 'object') {
+ return typeof actual === 'number' && Number.isNaN(actual) &&
+ Number.isNaN(expected);
+ }
+ if (typeof expected !== 'object' || actual === null || expected === null) {
return false;
}
const actualTag = objectToString(actual);