apt-map
v1.0.6
Published
Convenient iterable collection based on ES6 Map
Downloads
2
Maintainers
Readme
apt-map
Convenient iterable map based on ES6 Map. Classic map has only forEach()
method,
which is not quite enough in many cases. AptMap implements the most commonly used methods
from array like filter, find, some etc.
AptMap<K, V>;
K
- generic type for key, can be any type including object
V
- generic type for value, can be any type including object
Example:
const obj = {
a: 1,
b: 2,
};
const entries: [string, number][] = Object.entries(obj);
const map = new AptMap<string, number>();
Installation
npm install --save apt-map
Features
- Combines pros of array and
ES6 Map
(classic js object). You can work with the collection similar way as with an array and also able to get element by key withO(1)
complexity. - Extends basic ES6 Map so backward compatible and traditional
Map
can be substituted withAptMap
when needed.
Please check the generated documentation.