invert-hash
Inverts an object hash
Last updated 13 years ago by mikolalysenko .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install invert-hash 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.0.0                                ...           latest (13 years ago)

1 Versions

  • 0.0.0                                ...           13 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |