is-weakset
Is this value a JS WeakSet? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
Last updated 8 months ago by ljharb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install is-weakset 
SYNC missed versions from official npm registry.

is-weakset Version Badge

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

Current Tags

  • 2.0.3                                ...           latest (8 months ago)

6 Versions

  • 2.0.3                                ...           8 months ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (21)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE