0.2.1 • Published 8 years ago

deepmap v0.2.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

deepmap

Maps with multiple keys per value

Supports the following Map methods:

  • clear
  • delete
  • has
  • get
  • set

All other Map methods & properties, including well-known symbols and coercion logic, are not catered for at present.

Signature for all methods is the same as for Map, except that in place of a key, it instead accepts an array of keys.

map[ method ]( key, value? )

...DeepMaps instead provide:

map[ method ]( [ ...keys ], value? )

Ergo:

const sums = new DeepMap()

sums.set( [ 1, 2 ], 3 )

sums.has( 1 )           // false

sums.has( [ 1 ] )       // false

sums.has( [ 1, 2 ] )    // true

sums.get( [ 1, 2 ] )    // 3

sums.delete( [ 1, 2 ] ) // true

sums.has( [ 1, 2 ] )    // false
0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

1.0.0

9 years ago