You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
765 B
765 B
primitive-pool
Get object for a primitive value. Useful to make WeakMap store strings/numbers and other primitives.
Usage
let p = require('primitive-pool')
let map = new WeakMap()
map.set(p('abc'), 123)
map.get(p('abc')) // 123
map.set(p``, 456)
map.get(p``) // 456
map.set(p(null), 789)
map.get(p(null)) // 789
map.set(p(123), 'abc')
map.get(p(123)) // 'abc'