
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Is this value a JS Set? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
Supply Chain Security
Vulnerability
Quality
Maintenance
License
Socket optimized override available
MaintenancePackage can be replaced with a Socket optimized override.
Found 1 instance in 1 package
The `is-set` npm package is designed to provide a simple and efficient way to check if a given value is a Set object. This can be particularly useful when working with collections of unique values and you need to ensure that the data structure being manipulated or checked is indeed a Set.
Check if a value is a Set
This feature allows you to verify if a given value is an instance of a Set. It is particularly useful when you need to differentiate between Set objects and other iterable or collection types in JavaScript, such as Arrays, Objects, or even WeakSets. The code sample demonstrates how to use `is-set` to check various values, showing that it correctly identifies Set instances and distinguishes them from other types.
"use strict";\nconst isSet = require('is-set');\n\nconsole.log(isSet(new Set())); // true\nconsole.log(isSet(new WeakSet())); // false\nconsole.log(isSet([1, 2, 3])); // false\nconsole.log(isSet({})); // false\nconsole.log(isSet(undefined)); // false"
While `lodash.isset` does not exist as a standalone package, Lodash as a utility library offers functions like `_.isSet` which provide similar functionality to `is-set`. Lodash's `_.isSet` function checks if a value is classified as a Set object. The main difference is that Lodash offers a wide range of utility functions beyond checking for Sets, making it a more comprehensive solution for different types of data manipulations and checks.
The `is` package offers a wide range of type-check functions, including checks for Sets. Similar to `is-set`, it can be used to determine if a given value is a Set. However, `is` goes beyond just Sets, offering type checks for a variety of JavaScript data types and structures, making it a more versatile package if you need to perform multiple types of checks.
Is this value a JS Set? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
var isSet = require('is-set');
assert(!isSet(function () {}));
assert(!isSet(null));
assert(!isSet(function* () { yield 42; return Infinity; });
assert(!isSet(Symbol('foo')));
assert(!isSet(1n));
assert(!isSet(Object(1n)));
assert(!isSet(new Map()));
assert(!isSet(new WeakSet()));
assert(!isSet(new WeakMap()));
assert(isSet(new Set()));
class MySet extends Set {}
assert(isSet(new MySet()));
Simply clone the repo, npm install
, and run npm test
v2.0.3 - 2024-03-08
9d26ac6
node/install
instead of node/run
; use codecov
action 3c91325
8fcc646
eslint
, @ljharb/eslint-config
, object-inspect
, safe-publish-latest
, tape
91caa24
130e57b
eslint
, @ljharb/eslint-config
, aud
, auto-changelog
, es5-shim
, object-inspect
, tape
4d75ee2
052fdce
eslint
, @ljharb/eslint-config
, auto-changelog
, core-js
, es5-shim
, object-inspect
, safe-publish-latest
, tape
eb31797
8c478ba
a0dac6b
@ljharb/eslint-config
, aud
, es6-shim
, object-inspect
, tape
28d75a3
eslint
, @ljharb/eslint-config
, aud
, object-inspect
, tape
7b2a4a7
eslint
, @ljharb/eslint-config
, es5-shim
, tape
20ce047
e6e1796
engines.node
9ed19af
prepublishOnly
script for npm 7+ 618f861
76e890e
sideEffects
flag e21859b
FAQs
Is this value a JS Set? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
The npm package is-set receives a total of 29,574,436 weekly downloads. As such, is-set popularity was classified as popular.
We found that is-set 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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.