add _.isFinite - verifies is a number between Inf && -Inf

This commit is contained in:
Raymond May Jr
2012-03-25 10:43:30 -05:00
parent c46cd354c2
commit 705eff4826

View File

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