🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

is-weakref

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-weakref

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

1.0.1
Source
npm
Version published
Weekly downloads
36M
-21.37%
Maintainers
1
Weekly downloads
 
Created
Source

is-weakref Version Badge

dependency status dev dependency status License Downloads

npm badge

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

Keywords

weakref

FAQs

Package last updated on 05 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts