invert-hash

0.0.0 • Public • Published

invert-hash

Computes the inverse of a hash, assuming that it is bijective.

Example

 
var invert = require("invert-hash")
 
console.log(invert({
  'a': 1,
  'b': 2,
  'c': 3
}))
 
//Prints out:
//
//  {
//    1: 'a',
//    2: 'b',
//    3: 'c'
//  }
//

Install

npm install invert-hash

require("invert-hash")(obj)

Computes the inverse of a hash

  • obj is a hash object

Returns An object whose keys are the values of obj and whose values are the keys of object.

Credits

(c) 2013 Mikola Lysenko. MIT License

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.0
    57
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.0
    57

Package Sidebar

Install

npm i invert-hash

Weekly Downloads

35

Version

0.0.0

License

MIT

Last publish

Collaborators

  • mikolalysenko