• Return a new object that only has the properties that match the specified predicate.

    Optionally the predicate can be specified to be recursive; if the predicate returns a trueish value for a property that is an object and the recursive option is specified the object will be filtered recursively. The recursive option defaults to false.

    Type Parameters

    • T extends object

    Parameters

    • obj: T

      Object to evaluate

    • predicate: ((key, value, obj) => boolean)

      Predicate which when true means the property is included otherwise the property is excluded

        • (key, value, obj): boolean
        • Parameters

          • key: string
          • value: any
          • obj: T

          Returns boolean

    • Optional options: {
          recusive?: boolean;
      }
      • Optional recusive?: boolean

    Returns T

    New object with only the properties for which the predicate returned a trueish value