TapMap
The TapMap class extends JavaScript's native Map with a single, powerful method:
const map = // "set the key 'foo' to 'bar' if 'foo' is not set"map // 'bar'map // 'bar' // "set the key 'foo' to `Math.random()` if 'foo' is not set"map // 'bar' (already set)map // 0.3144890857392...
The default factory function returns a new TapMap
, so you can
use it to quickly build and then query deep structures:
const map = map // '!'map // TapMap({3: '!'})
...or you can provide your own factory:
const map = const values = 'foo' 'bar' 'foo' 'baz'// it's better not to define this in the loopconst makeList = for const index value of Object mapfor const value indices of map console
Install
npm install tap-map
Usage
const TapMap = const map = // do your worst