added suggested speed boost for isNumber

This commit is contained in:
Jeremy Ashkenas
2010-01-20 13:50:08 -05:00
parent 52ac3db77c
commit 30858c50a8
4 changed files with 15 additions and 12 deletions

View File

@@ -503,7 +503,7 @@
// Is a given value a number?
_.isNumber = function(obj) {
return toString.call(obj) === '[object Number]';
return (obj === +obj) || (toString.call(obj) === '[object Number]');
};
// Is a given value a date?