Security News
OpenJS: “XZ Utils Cyberattack Likely Not an Isolated Incident”
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.
is-arguments
Advanced tools
Weekly downloads
Package description
The is-arguments npm package is designed to check if a given value is an arguments object. This can be particularly useful in functions where you need to differentiate between an array and the arguments object, or when trying to ensure compatibility across different JavaScript environments where the typeof operator might not suffice.
Check if a value is an arguments object
This feature allows you to check if a given value is an arguments object. It's particularly useful in scenarios where you need to distinguish between an array and the arguments object passed to a function.
const isArguments = require('is-arguments');
function example() {
console.log(isArguments(arguments)); // true
console.log(isArguments([1, 2, 3])); // false
}
example();
Similar to is-arguments, isarray checks if a given value is an array. While is-arguments focuses on identifying arguments objects, isarray focuses on arrays. Both packages serve to identify specific data structures, making them useful in different but somewhat related scenarios.
Part of the Lodash library, lodash.isarguments provides a similar functionality to is-arguments by checking if a value is an arguments object. The main difference is that lodash.isarguments comes as part of the larger Lodash utility library, which offers a wide range of functions for different types of data manipulation and checking.
Readme
Is this an arguments object? It's a harder question than you think.
var isArguments = require('is-arguments');
var assert = require('assert');
assert.equal(isArguments({}), false);
assert.equal(isArguments([]), false);
(function () {
assert.equal(isArguments(arguments), true);
}())
If you have modified an actual arguments
object by giving it a Symbol.toStringTag
property, then this package will return false
.
Simply clone the repo, npm install
, and run npm test
FAQs
Is this an arguments object? It's a harder question than you think.
The npm package is-arguments receives a total of 19,061,391 weekly downloads. As such, is-arguments popularity was classified as popular.
We found that is-arguments demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.
Company News
Come meet the Socket team at BSidesSF and RSA! We're sponsoring several fun networking events and we would love to see you there.
Security News
OSI is starting a conversation aimed at removing the excuse of the SaaS loophole for companies navigating licensing and the complexities of doing business with open source.