@eroyeroy/utils - v0.1.0
    Preparing search index...

    Function filterValues

    • Creates a new object containing only the entries for which predicate returns true.

      Type Parameters

      • T extends object

      Parameters

      • obj: T

        The source object.

      • predicate: (value: T[keyof T], key: keyof T) => boolean

        Function to test each value and key.

      Returns Partial<T>

      filterValues({ a: 1, b: 2, c: 3 }, v => v > 1) // => { b: 2, c: 3 }