Computes the inverse of a hash, assuming that it is bijective.
var invert = require("invert-hash")
console.log(invert({
'a': 1,
'b': 2,
'c': 3
}))
//Prints out:
//
// {
// 1: 'a',
// 2: 'b',
// 3: 'c'
// }
//
npm install invert-hash
require("invert-hash")(obj)
Computes the inverse of a hash
obj
is a hash objectReturns An object whose keys are the values of obj
and whose values are the keys
of object.
(c) 2013 Mikola Lysenko. MIT License