1.2.0 • Published 3 years ago

index-map-class v1.2.0

Weekly downloads
5
License
ISC
Repository
github
Last release
3 years ago

index-map

A bi-directional map that allow to create a link between index and object, so that you can retrieve either one if you know the other element.

How to use

const map = new IndexMap();
const index = "myIndex";
const object = {"test": true};

map.set(index, object);

map.has(index); // true
map.has(object); // true

map.get(index).test // true
map.get(object); // "myIndex"

map.delete(index);
// or
map.delete(object);