From c0e8cc0254a74f7a19cd9599fcf6b59b75c2dee2 Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 26 May 2015 11:14:25 -0700 Subject: [PATCH] Remove `_.isArguments` fallback and `_.support.argsTag`. --- lodash.src.js | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 5aa050a79..1da3d6cca 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -999,15 +999,6 @@ Ctor.prototype = { 'valueOf': x, 'y': x }; for (var key in new Ctor) { props.push(key); } - /** - * Detect if the `toStringTag` of `arguments` objects is resolvable - * (all but Firefox < 4, IE < 9). - * - * @memberOf _.support - * @type boolean - */ - support.argsTag = objToString.call(arguments) == argsTag; - /** * Detect if `name` or `message` properties of `Error.prototype` are * enumerable by default (IE < 9, Safari < 5.1). @@ -4493,10 +4484,8 @@ support = lodash.support; // Exit early for non `Object` objects. - if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isHostObject(value)) || - (!hasOwnProperty.call(value, 'constructor') && - (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor))) || - (!support.argsTag && isArguments(value))) { + if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isHostObject(value) && !isArguments(value)) || + (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { return false; } // IE < 9 iterates inherited properties before own properties. If the first @@ -8574,14 +8563,8 @@ * // => false */ function isArguments(value) { - return isObjectLike(value) && isArrayLike(value) && objToString.call(value) == argsTag; - } - // Fallback for environments without a `toStringTag` for `arguments` objects. - if (!support.argsTag) { - isArguments = function(value) { - return isObjectLike(value) && isArrayLike(value) && - hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); - }; + return isObjectLike(value) && isArrayLike(value) && + hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); } /** @@ -9039,7 +9022,7 @@ * // => true */ var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { - if (!(value && objToString.call(value) == objectTag) || (!lodash.support.argsTag && isArguments(value))) { + if (!(value && objToString.call(value) == objectTag && !isArguments(value))) { return false; } var valueOf = getNative(value, 'valueOf'),