Options
All
  • Public
  • Public/Protected
  • All
Menu

Module filterObject

Index

References

Functions Object

References

Renames and re-exports filterObject

Object Functions

  • filterObject<T>(object: Record<string, T>, predicate?: Predicate<string, T, Record<string, T>>): T[]
  • filterObject<T>(object: T[], predicate?: Predicate<string, T, T[]>): T[]
  • filterObject(object: any, predicate?: Predicate<any, any, any>): any[]
  • Iterates over properties of object, returning an array of all elements predicate returns truthy for. The predicate is invoked with three arguments: (value, key, object).

    If you want an object in return, consider pickBy.

    since

    5.3.0

    see

    pickBy,pull,pullAll,pullAllBy,pullAllWith,pullAt,remove,reject

    example
    const object = { 'a': 5, 'b': 8, 'c': 10 }

    filterObject(object, (n) => !(n % 5))
    // => [5, 10]

    Type parameters

    • T

    Parameters

    • object: Record<string, T>

      The object to iterate over.

    • Optional predicate: Predicate<string, T, Record<string, T>>

      The function invoked per iteration.

    Returns T[]

    Returns the new filtered array.

  • Type parameters

    • T

    Parameters

    • object: T[]
    • Optional predicate: Predicate<string, T, T[]>

    Returns T[]

  • Parameters

    • object: any
    • Optional predicate: Predicate<any, any, any>

    Returns any[]