liup a01a5aa773 | há 3 semanas | |
---|---|---|
.. | ||
.github | há 3 semanas | |
test | há 3 semanas | |
.editorconfig | há 3 semanas | |
.eslintrc | há 3 semanas | |
.nycrc | há 3 semanas | |
CHANGELOG.md | há 3 semanas | |
LICENSE | há 3 semanas | |
README.md | há 3 semanas | |
index.d.ts | há 3 semanas | |
index.js | há 3 semanas | |
package.json | há 3 semanas | |
tsconfig.json | há 3 semanas |
Is this value a JS WeakMap? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
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()));
Simply clone the repo, npm install
, and run npm test