Skip to content

[Feature Request-Object] PickBy #157

@lveillard

Description

@lveillard

Hello!
I was wondering if somebody is up to build this one

const root = {a: 2, b: 3, c: {d: 7}, e:8}
pickBy(root, ((x) => x>2) // result: {b:3, e:8}
pickBy(root, ((x) => x.d == 7) // result {c: {d: 7}}

is similar to array.find() but for objects

Smething like this:

const pickBy = (obj, fn) => Object.fromEntries(Object.entries(obj).filter(fn))
PickBy(root, ((k,v])=> v>2)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions