This commit is contained in:
Jeremy Ashkenas
2011-10-24 11:28:26 -04:00
parent 58c88ccc59
commit 43878e8ef0

View File

@@ -758,16 +758,15 @@
}; };
// Is a given variable an arguments object? // Is a given variable an arguments object?
_.isArguments = toString.call(arguments) == '[object Arguments]' if (toString.call(arguments) == '[object Arguments]') {
? function(obj) { _.isArguments = function(obj) {
return toString.call(obj) == '[object Arguments]'; return toString.call(obj) == '[object Arguments]';
}
: function(obj) {
return obj
? hasOwnProperty.call(obj, 'callee')
&& hasOwnProperty.call(obj, 'length')
: false;
}; };
} else {
_.isArguments = function(obj) {
return !!(obj && hasOwnProperty.call(obj, 'callee'));
};
}
// Is a given value a function? // Is a given value a function?
_.isFunction = function(obj) { _.isFunction = function(obj) {