1.0.0 • Published 7 years ago

key-map v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

key-map 🔜

When you remove duplicates in a collection mapped by keys, you may want to keep track of old keys and their new equivalent.

npm version build status dependency status dev dependency status ISC-licensed chat on gitter

Installing

npm install key-map

Usage

const keyMap = require('key-map')
const m = keyMap(['a', 'b', 'c'])

m.get('a') // -> 'a'
m.get('b') // -> 'b'
m.get('c') // -> 'c'

m.map('c', 'b') // map c to b
m.map('b', 'a') // map b to a

m.get('a') // -> 'a'
m.get('b') // -> 'a'
m.get('c') // -> 'a'

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.