mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
Underscore 0.4.4, with isNumber, isString, and isEqual(NaN, NaN)
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
if (typeof exports !== 'undefined') exports._ = _;
|
||||
|
||||
// Current version.
|
||||
_.VERSION = '0.4.3';
|
||||
_.VERSION = '0.4.4';
|
||||
|
||||
/*------------------------ Collection Functions: ---------------------------*/
|
||||
|
||||
@@ -399,6 +399,8 @@
|
||||
if (a == b) return true;
|
||||
// One of them implements an isEqual()?
|
||||
if (a.isEqual) return a.isEqual(b);
|
||||
// Both are NaN?
|
||||
if (_.isNumber(a) && _.isNumber(b) && isNaN(a) && isNaN(b)) return true;
|
||||
// If a is not an object by this point, we can't handle it.
|
||||
if (atype !== 'object') return false;
|
||||
// Nothing else worked, deep compare the contents.
|
||||
@@ -430,6 +432,16 @@
|
||||
return Object.prototype.toString.call(obj) == '[object Function]';
|
||||
};
|
||||
|
||||
// Is a given value a String?
|
||||
_.isString = function(obj) {
|
||||
return Object.prototype.toString.call(obj) == '[object String]';
|
||||
};
|
||||
|
||||
// Is a given value a Number?
|
||||
_.isNumber = function(obj) {
|
||||
return Object.prototype.toString.call(obj) == '[object Number]';
|
||||
};
|
||||
|
||||
// Is a given variable undefined?
|
||||
_.isUndefined = function(obj) {
|
||||
return typeof obj == 'undefined';
|
||||
|
||||
Reference in New Issue
Block a user