Back
vendored
is-arguments
v1.0.4
MIT

isArguments

The published dependency-free is-arguments package as a vendorable file. Useful when you want the classic arguments-object check locally without keeping the npm dependency.

Why copy this?

This page ships the dependency-free is-arguments file in both raw and normalized forms. The value is to keep the classic arguments-object check local and inspectable without another dependency.

Native alternative: There is no direct native helper for the package's exact arguments-object detection contract.

Note: Current is-arguments releases pull in helper packages. This snippet intentionally uses the simpler 1.0.4 release line as a vendorable first pass.

This copy is your responsibility once you adopt it. It does not automatically receive upstream bug fixes or security updates.

Snippet
Copy-first distribution
Normalized
ESM / TS / normalized
Runtime: node, bun
/**
 * Derived from [email protected]
 * Rule-based normalized variant generated by this repository.
 * Preserve the upstream license and attribution notices when copying this file.
 */
/**
 * Derived from [email protected]
 * Rule-based normalized variant generated by this repository.
 * See THIRD_PARTY_NOTICES.md for upstream license and attribution details.
 */
"use strict";
var hasToStringTag = typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol";
var toStr = Object.prototype.toString;

var isStandardArguments = function isArguments(value) {
  if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) {
    return false;
  }
  return toStr.call(value) === "[object Arguments]";
};

var isLegacyArguments = function isArguments(value) {
  if (isStandardArguments(value)) {
    return true;
  }
  return (
    value !== null &&
    typeof value === "object" &&
    typeof value.length === "number" &&
    value.length >= 0 &&
    toStr.call(value) !== "[object Array]" &&
    toStr.call(value.callee) === "[object Function]"
  );
};

var supportsStandardArguments = (function () {
  return isStandardArguments(arguments);
})();

isStandardArguments.isLegacyArguments = isLegacyArguments;

export default supportsStandardArguments ? isStandardArguments : isLegacyArguments;
Variant note: Rule-based normalization for modern TS projects. The goal is easier import and build compatibility, not changed behavior.
Transforms: module.exports-to-export-default, js-extension-to-ts-extension
Validation: This normalized variant is intended to stay oxlint and oxfmt clean in this repo.
Raw
CJS / JS / raw
Runtime: node, bun
'use strict';

var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
var toStr = Object.prototype.toString;

var isStandardArguments = function isArguments(value) {
  if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {
    return false;
  }
  return toStr.call(value) === '[object Arguments]';
};

var isLegacyArguments = function isArguments(value) {
  if (isStandardArguments(value)) {
    return true;
  }
  return value !== null &&
    typeof value === 'object' &&
    typeof value.length === 'number' &&
    value.length >= 0 &&
    toStr.call(value) !== '[object Array]' &&
    toStr.call(value.callee) === '[object Function]';
};

var supportsStandardArguments = (function () {
  return isStandardArguments(arguments);
}());

isStandardArguments.isLegacyArguments = isLegacyArguments;

module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
Variant note: Published package file kept as-is from the dependency-free release line.