1.0.0 • Published 6 years ago
weakable v1.0.0
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
1.0.0
6 years ago