@nfi/tuplemap
v1.0.1
Published
Map implementation using N-tuples as multi-dimensional keys.
Downloads
171
Maintainers
Readme
@nfi/tuplemap
Map implementation using N-tuples as multi-dimensional keys; matches the interface and behaviour of the ES2015 Map wherever possible.
Installation
npm install @nfi/tuplemap
Documentation
API documentation is available here.
Iteration Order
TupleMaps do not guarantee iteration over keys in insertion order like Maps do; iteration order is consistent for any given set of keys, but not easily predictable.
Deletion Strategy
By default, TupleMaps clean up empty/unneeded internal structures on every key deletion.
The delete
method has an optional parameter, prune
, that can be used to disable this
behaviour. This strategy can increase performance for collections with high turnover on
a consistent set of keys, but must be supplemented with periodic calls to prune
or
clear
to manually clean up unused structures or they will leak memory over time.