mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
have to define isNumber before _.each will work in IE
This commit is contained in:
@@ -476,9 +476,14 @@
|
|||||||
return typeof obj == 'undefined';
|
return typeof obj == 'undefined';
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define the isArray, isDate, isFunction, isNumber, isRegExp, and
|
// have to define isNumber before _.each will work in IE
|
||||||
|
_.isNumber = function(obj) {
|
||||||
|
return Object.prototype.toString == '[object Number]';
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define the isArray, isDate, isFunction, isRegExp, and
|
||||||
// isString functions based on their toString identifiers.
|
// isString functions based on their toString identifiers.
|
||||||
_.each(['Array', 'Date', 'Function', 'Number', 'RegExp', 'String'], function(type) {
|
_.each(['Array', 'Date', 'Function', 'RegExp', 'String'], function(type) {
|
||||||
var toString = Object.prototype.toString, typeString = '[object ' + type + ']';
|
var toString = Object.prototype.toString, typeString = '[object ' + type + ']';
|
||||||
_['is' + type] = function(obj) {
|
_['is' + type] = function(obj) {
|
||||||
return toString.call(obj) == typeString;
|
return toString.call(obj) == typeString;
|
||||||
|
|||||||
Reference in New Issue
Block a user