From a7fe7ada142b0b7d0ff790b2c9fb9314a553be3c Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 30 Mar 2014 20:30:03 -0700 Subject: [PATCH] Fixing variable name collisions --- es5-shim.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/es5-shim.js b/es5-shim.js index 69e0c4f7..70e7c1f0 100644 --- a/es5-shim.js +++ b/es5-shim.js @@ -680,29 +680,29 @@ if (!Object.keys) { }, isArguments = function isArguments(value) { var str = _toString(value); - var isArguments = str === '[object Arguments]'; - if (!isArguments) { - isArguments = !Array.isArray(str) + var isArgs = str === '[object Arguments]'; + if (!isArgs) { + isArgs = !Array.isArray(str) && value !== null && typeof value === 'object' && typeof value.length === 'number' && value.length >= 0 && isFunction(value.callee); } - return isArguments; + return isArgs; }; Object.keys = function keys(object) { - var isFunction = isFunction(object), - isArguments = isArguments(object), + var isFn = isFunction(object), + isArgs = isArguments(object), isObject = object !== null && typeof object === 'object'; - if (!isObject && !isFunction) { + if (!isObject && !isFn) { throw new TypeError("Object.keys called on a non-object"); } var keys = [], - skipProto = hasProtoEnumBug && isFunction; + skipProto = hasProtoEnumBug && isFn; for (var name in object) { if (!(skipProto && name === 'prototype') && owns(object, name)) { keys.push(name);