Skip to content

Allows to put arrays into maps. Works similarly like ES6 Maps.

License

Notifications You must be signed in to change notification settings

Daninet/n-dimensional-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status license

Allows to put arrays into maps. Works similarly like ES6 Maps.

Install

npm i n-dimensional-map

Example

const NMap = require('n-dimensional-map');
const map = new NMap();
map.set(1, 'a');
map.set(2, 'b');
map.set([2], 'c');
console.log(map); // NMap { (1) => a, (2) => c }
map.set(1, 2, 3, 'd');
console.log(map.get([1, 2, 3])); // d
map.set(1, 5, 'e');
map.set([1, 5], 'f');
console.log(map.get(1, 5)); // f
console.log(map); // NMap { (1) => a, (1, 2, 3) => d, (1, 5) => f, (2) => c }
map.delete(1, 2, 3);
console.log(map); // NMap { (1) => a, (1, 5) => f, (2) => c }
console.log(map.has(1, 2, 3)); // false
console.log(map.has(1, 5)); // true

License

MIT

About

Allows to put arrays into maps. Works similarly like ES6 Maps.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published