Skip to content

Commit

Permalink
Merge pull request jashkenas#2519 from CodeFalling/fix-isnan-error-sy…
Browse files Browse the repository at this point in the history
…mbols

fix _.isNaN errors on symbols
  • Loading branch information
megawac committed Apr 28, 2016
2 parents 1e68f06 + e1741ab commit 28e9704
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions test/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,9 @@
assert.notOk(_.isNaN(new Number(0)), 'wrapped 0 is not NaN');
assert.ok(_.isNaN(NaN), 'but NaN is');
assert.ok(_.isNaN(new Number(NaN)), 'wrapped NaN is still NaN');
if (typeof Symbol !== 'undefined'){
assert.notOk(_.isNaN(Symbol()), 'symbol is not NaN');
}
});

QUnit.test('isNull', function(assert) {
Expand Down
2 changes: 1 addition & 1 deletion underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@

// Is the given value `NaN`?
_.isNaN = function(obj) {
return isNaN(obj) && _.isNumber(obj);
return _.isNumber(obj) && isNaN(obj);
};

// Is a given value a boolean?
Expand Down

0 comments on commit 28e9704

Please sign in to comment.