is-weakmap (2.0.2)
Published 2026-02-24 13:58:43 +00:00 by atheaadmin
Installation
registry=npm install is-weakmap@2.0.2"is-weakmap": "2.0.2"About this package
is-weakmap 
Is this value a JS WeakMap? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
Example
var isWeakMap = require('is-weakmap');
assert(!isWeakMap(function () {}));
assert(!isWeakMap(null));
assert(!isWeakMap(function* () { yield 42; return Infinity; });
assert(!isWeakMap(Symbol('foo')));
assert(!isWeakMap(1n));
assert(!isWeakMap(Object(1n)));
assert(!isWeakMap(new Set()));
assert(!isWeakMap(new WeakSet()));
assert(!isWeakMap(new Map()));
assert(isWeakMap(new WeakMap()));
class MyWeakMap extends WeakMap {}
assert(isWeakMap(new MyWeakMap()));
Tests
Simply clone the repo, npm install, and run npm test
Dependencies
Development Dependencies
| ID | Version |
|---|---|
| @arethetypeswrong/cli | ^0.15.0 |
| @ljharb/eslint-config | ^21.1.0 |
| @types/for-each | ^0.3.3 |
| @types/object-inspect | ^1.8.4 |
| @types/tape | ^5.6.4 |
| aud | ^2.0.4 |
| auto-changelog | ^2.4.0 |
| core-js | ^2.6.12 |
| es5-shim | ^4.6.7 |
| es6-shim | ^0.35.8 |
| eslint | =8.8.0 |
| for-each | ^0.3.3 |
| in-publish | ^2.0.1 |
| npmignore | ^0.3.1 |
| nyc | ^10.3.2 |
| object-inspect | ^1.13.1 |
| safe-publish-latest | ^2.0.0 |
| tape | ^5.7.5 |
| typescript | next |
Keywords
map
weakmap
set
weakset
collection
is
robust
