is-weakset <sup>Version Badge</sup>

github actions coverage License Downloads

npm badge

Is this value a JS WeakSet? This module works cross-realm/iframe, and despite ES6 @@toStringTag.

Example

var isWeakSet = require('is-weakset');
assert(!isWeakSet(function () {}));
assert(!isWeakSet(null));
assert(!isWeakSet(function* () { yield 42; return Infinity; });
assert(!isWeakSet(Symbol('foo')));
assert(!isWeakSet(1n));
assert(!isWeakSet(Object(1n)));

assert(!isWeakSet(new Set()));
assert(!isWeakSet(new WeakMap()));
assert(!isWeakSet(new Map()));

assert(isWeakSet(new WeakSet()));

class MyWeakSet extends WeakSet {}
assert(isWeakSet(new MyWeakSet()));

Tests

Simply clone the repo, npm install, and run npm test

is-weakset - Installation

To install is-weakset via this registry, you'll need to install via the --registry parameter with your package manager.

n

NPM

npm install is-weakset --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Yarn

yarn config set registry https://js.registry.sudovanilla.org
yarn install is-weakset

Learn more about the config option.

PNPM

pnpm install is-weakset --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Bun Logo

Bun

bun install is-weakset --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Learn more about setting this up in your bunfig.toml configuration.


For Deno, add the following to your .npmrc file in your directory:

registry="https://js.registry.sudovanilla.org"

Then run the deno install command.

is-weakset - Download

Download Tarball (v2.0.4)

Integrity sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==
SHASUM c9f5deb0bc1906c6d6f1027f284ddf459249daca
Tarball https://js.registry.sudovanilla.org/is-weakset/-/is-weakset-2.0.4.tgz