Function objFilterMutable

  • Mutably filters the properties of an object based on a predicate function.

    Type Parameters

    Parameters

    • object: T

      The object to filter.

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

      The callback function used to filter the object properties.

        • (value, key): boolean
        • Parameters

          • value: T[keyof T]
          • key: keyof T

          Returns boolean

    • getKeys: ((value) => ObjectKey[]) = Object.keys

      The function used to get the keys of the object.

    Returns T

    Example

    const obj = { a: 1, b: 2, c: 3 };
    objFilter(obj, (value, key) => value > 1);
    //=> { b: 2, c: 3 }

Generated using TypeDoc