weakmap-shim
A minimal weakmap shim
Example
var weakMap = var map = var key = {} mapvar v = map // 'some value'
create-store Example
var createStore = var store = var key = {} var value = // `value` is weakly bound to `key`. `value` is a plain objectvaluefoo = 'bar' var value2 = var v = value2foo; // 'bar'var bool = value === value2; // true
Motivation
Benvie has an excellent weakmap module that's far more robust. However it contains quite a bit of loc.
weakmap
: 7451 bytesweakmap-shim
: 2106 bytesweakmap-shim/create-store
: 1311 bytes
This module is only worthwhile if you want to add a weakmap to a small module (10 - 30 loc) and dont want to bloat it with a heavier weakmap
Installation
npm install weakmap-shim
Contributors
- Raynos