Make _.isArguments length check consistent with its fallback.

This commit is contained in:
John-David Dalton
2014-08-23 12:13:10 -07:00
parent fca5fda9da
commit 87879a6784

View File

@@ -7027,7 +7027,8 @@
* // => false * // => false
*/ */
function isArguments(value) { function isArguments(value) {
return (value && typeof value == 'object' && typeof value.length == 'number' && var length = (value && typeof value == 'object') ? value.length : undefined;
return (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER &&
toString.call(value) == argsClass) || false; toString.call(value) == argsClass) || false;
} }
// fallback for environments without a `[[Class]]` for `arguments` objects // fallback for environments without a `[[Class]]` for `arguments` objects