key-by-val

1.0.0 • Public • Published

key-by-val

tiny fn I seem to find myself needing often

var kByV = require('key-by-val')
var consts = {
  public: 1,
  private: 2,
  happy: 3
}
 
var blah = {
  type: 3  
}
 
var typeName = kByV(consts, blah.type) // === 'happy'

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i key-by-val

    Weekly Downloads

    2

    Version

    1.0.0

    License

    ISC

    Last publish

    Collaborators

    • spwilko
    • genevayngrib
    • pgmemk
    • tenaciousmv