NewDash

    Function filterObject

    • 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.

      Type Parameters

      • T

      Parameters

      • object: Record<string, T>

        The object to iterate over.

      • Optionalpredicate: Predicate<string, T, Record<string, T>>

        The function invoked per iteration.

      Returns T[]

      Returns the new filtered array.

      5.3.0

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

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

      filterObject(object, (n) => !(n % 5))
      // => [5, 10]
    • 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.

      Type Parameters

      • T

      Parameters

      • object: T[]

        The object to iterate over.

      • Optionalpredicate: Predicate<string, T, T[]>

        The function invoked per iteration.

      Returns T[]

      Returns the new filtered array.

      5.3.0

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

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

      filterObject(object, (n) => !(n % 5))
      // => [5, 10]
    • 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.

      Parameters

      • object: any

        The object to iterate over.

      • Optionalpredicate: Predicate

        The function invoked per iteration.

      Returns any[]

      Returns the new filtered array.

      5.3.0

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

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

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