lodash find by object property
Vico

Vico @vicoerv

Location:
Denpasar, Bali
Joined:
Jul 17, 2017

lodash find by object property

Publish Date: Feb 6 '19
5 0

Have you ever figured how to get array of object from its property with single line? then try use lodash/find

npm install lodash/find # or yarn add lodash/find
import find from 'lodash/find'

const obj = [
  { name: 'vico', level: 1 },
  { name: 'ben', level: 99 }
]

const vico = find(obj, ['name', 'vico'])

console.log(vico)
// output: { name: 'vico', level: 1 }

Comments 0 total

    Add comment