UNPKG

util-ex

Version:

Browser-friendly enhanced util fully compatible with standard node.js

27 lines (25 loc) 807 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; exports.isArguments = isArguments; const argsClass = '[object Arguments]'; /** * Checks if a value is an `arguments` object. * @param {*} value - The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, else `false`. * @example * ```js * function myFunction() { * return isArguments(arguments); * } * console.log(myFunction()); // true, since the `arguments` object is an instance of `Arguments` * isArguments([1, 2, 3]); // => false * ``` */ function isArguments(value) { return value && typeof value === 'object' && typeof value.length === 'number' && toString.call(value) === argsClass || false; } ; var _default = exports.default = isArguments;