Update vendor/underscore and continue to tweak _.throttle unit tests to avoid false fails.

Former-commit-id: b5ba7b53e3bbebb3fa42da7e197f746515c8efb0
This commit is contained in:
John-David Dalton
2012-12-24 02:19:42 -06:00
parent 408a5c168f
commit ef7cb26b01
4 changed files with 61 additions and 81 deletions

View File

@@ -938,8 +938,8 @@
return obj === Object(obj);
};
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) {
// Add some isType methods: isArguments, isString, isNumber, isDate, isRegExp.
each(['Arguments', 'String', 'Number', 'Date', 'RegExp'], function(name) {
_['is' + name] = function(obj) {
return toString.call(obj) == '[object ' + name + ']';
};
@@ -953,10 +953,16 @@
};
}
// Optimize `isFunction` if appropriate.
if (typeof (/./) !== 'function') {
// Is a given variable a function?
_.isFunction = function(obj) {
return typeof obj === 'function';
};
// Define a fallback for older versions of Chrome, Firefox, and Safari, where
// a regexp is `typeof` "function".
if (_.isFunction(/./)) {
_.isFunction = function(obj) {
return typeof obj === 'function';
return toString.call(obj) == '[object Function]';
};
}