Skip to content

[Node.js] Returns true if a value can be used as a WeakSet item or a WeakMap key.

License

Notifications You must be signed in to change notification settings

lamansky/weakable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

weakable

A Node.js module that returns true if a value can be used as a WeakSet item or a WeakMap key.

Installation

npm install weakable --save

Usage

const weakable = require('weakable')
const set = new WeakSet()

const obj = {}
weakable(obj) // true
set.add(obj)

const str = 'test'
weakable(str) // false
set.add(str) // Uncaught TypeError: Invalid value used in weak set

About

[Node.js] Returns true if a value can be used as a WeakSet item or a WeakMap key.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published