is-weakref (1.1.1)
Published 2026-02-24 13:58:44 +00:00 by atheaadmin
Installation
registry=npm install is-weakref@1.1.1"is-weakref": "1.1.1"About this package
is-weakref 
[![npm badge][11]][1]
Is this value a JS WeakRef? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
Example
var isWeakRef = require('is-weakref');
assert(!isWeakRef(function () {}));
assert(!isWeakRef(null));
assert(!isWeakRef(function* () { yield 42; return Infinity; });
assert(!isWeakRef(Symbol('foo')));
assert(!isWeakRef(1n));
assert(!isWeakRef(Object(1n)));
assert(!isWeakRef(new Set()));
assert(!isWeakRef(new WeakSet()));
assert(!isWeakRef(new Map()));
assert(!isWeakRef(new WeakMap()));
assert(isWeakRef(new WeakRef({})));
class MyWeakRef extends WeakRef {}
assert(isWeakRef(new MyWeakRef({})));
Tests
Simply clone the repo, npm install, and run npm test
Dependencies
Dependencies
| ID | Version |
|---|---|
| call-bound | ^1.0.3 |
Development Dependencies
| ID | Version |
|---|---|
| @arethetypeswrong/cli | ^0.17.3 |
| @ljharb/eslint-config | ^21.1.1 |
| @ljharb/tsconfig | ^0.2.3 |
| @types/for-each | ^0.3.3 |
| @types/object-inspect | ^1.13.0 |
| @types/tape | ^5.8.1 |
| auto-changelog | ^2.5.0 |
| encoding | ^0.1.13 |
| eslint | =8.8.0 |
| for-each | ^0.3.4 |
| in-publish | ^2.0.1 |
| npmignore | ^0.3.1 |
| nyc | ^10.3.2 |
| object-inspect | ^1.13.3 |
| safe-publish-latest | ^2.0.0 |
| tape | ^5.9.0 |
| typescript | next |
Keywords
weakref
weak
ref
finalization
finalization registry