Find object(s) in a JSON tree.
npm i --save find-object
or
yarn add find-object
import { findFirst, findAll } from 'find-object'
const users = [
{ user: 'barney', age: 36, active: true },
{ user: 'fred', age: 40, active: false },
{ user: 'pebbles', age: 1, active: true }
]
findFirst(users, { user: 'fred' }) // user[1]
findAll(users, { active: true }) // [ user[0], users[2] ]
findAll(users, { unknown: true }) // []
findAll(users, { age: Object }) // find all objects that have age key, returns shallow copy of users
MIT