Skip to content

Commit 28e9704

Browse files
committed
Merge pull request #2519 from CodeFalling/fix-isnan-error-symbols
fix _.isNaN errors on symbols
2 parents 1e68f06 + e1741ab commit 28e9704

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

test/objects.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,9 @@
844844
assert.notOk(_.isNaN(new Number(0)), 'wrapped 0 is not NaN');
845845
assert.ok(_.isNaN(NaN), 'but NaN is');
846846
assert.ok(_.isNaN(new Number(NaN)), 'wrapped NaN is still NaN');
847+
if (typeof Symbol !== 'undefined'){
848+
assert.notOk(_.isNaN(Symbol()), 'symbol is not NaN');
849+
}
847850
});
848851

849852
QUnit.test('isNull', function(assert) {

underscore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@
13201320

13211321
// Is the given value `NaN`?
13221322
_.isNaN = function(obj) {
1323-
return isNaN(obj) && _.isNumber(obj);
1323+
return _.isNumber(obj) && isNaN(obj);
13241324
};
13251325

13261326
// Is a given value a boolean?

0 commit comments

Comments
 (0)