Merge pull request #524 from octatone/isFinite

New Feature: _.isFinite to compliment _.isNumber and _.isNaN
This commit is contained in:
Jeremy Ashkenas
2012-04-02 12:07:28 -07:00
2 changed files with 19 additions and 0 deletions

View File

@@ -824,6 +824,11 @@
return toString.call(obj) == '[object Number]';
};
// Is a givin number finite?
_.isFinite = function(obj) {
return _.isNumber(obj) && isFinite(obj);
};
// Is the given value `NaN`?
_.isNaN = function(obj) {
// `NaN` is the only value for which `===` is not reflexive.