Skip to content

Find all the keys that have the given value - node module

License

Notifications You must be signed in to change notification settings

anusaini/find-keys-for-value

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

find-keys-for-value

Find all the keys that have the given value - node module

Usage

  const findSingleValueInObject = require('find-keys-for-value').findSingleValueInObject
  findSingleValueInObject({a: 'b', b: 'c'}, 'c', (a, b) => a === b, x => console.log(x))
  { loc: 'b', val: 'c' }

  const findValuesInObject = require('find-keys-for-value').findValuesInObject
  findValuesInObject({ a: 'b', b: 'c' }, ['b', 'c'], (a, b) => a === b, x => console.log(x))
  { loc: 'a', val: 'b' }
  { loc: 'b', val: 'c' }

License

MIT © 2018