1 var isArrayLikeObject = require('./isArrayLikeObject');
3 /** `Object#toString` result references. */
4 var argsTag = '[object Arguments]';
6 /** Used for built-in method references. */
7 var objectProto = global.Object.prototype;
9 /** Used to check objects for own properties. */
10 var hasOwnProperty = objectProto.hasOwnProperty;
13 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
16 var objectToString = objectProto.toString;
18 /** Built-in value references. */
19 var propertyIsEnumerable = objectProto.propertyIsEnumerable;
22 * Checks if `value` is likely an `arguments` object.
27 * @param {*} value The value to check.
28 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
31 * _.isArguments(function() { return arguments; }());
34 * _.isArguments([1, 2, 3]);
37 function isArguments(value) {
38 // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
39 return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
40 (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
43 module.exports = isArguments;