Nibbling Perfect Macaroni
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

piratemap

1.0.3 • Public • Published

Pirate Map

An ES6 map that supports complex keys with shallow equals

Installation

$ yarn add piratemap

Why would I use this?

Because you want to use an object or array as a key in a Map.

But unless you keep a reference to the original key, you will not be able to retrieve a value.

const map = new Map()
 
map.set({x: 20, y: 20}, 'here be treasure')
 
map.get({x: 20, y: 30}) // undefined !!!

But with PirateMap, you can do this!

const map = new PirateMap()
 
map.set({x: 20, y: 20}, 'here be treasure')
 
map.get({x: 20, y: 30}) // 'here be treasure' !!!

How do I use it?

It has exactly the same API as the builtin Map class.

install

npm i piratemap

Downloadsweekly downloads

1

version

1.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability