Skip to main content

omitBy

Callable

  • omitBy<T, Predicate>(obj: T, predicate: Predicate): Partial<T>

  • Create a new object with all the properties excluded for which the predicate hold true.

    Example

    omitBy({foo: 1, bar: "foo"}, ([, v]) => isNumber(v))
    // => {bar: "foo"}

    Alternatives


    Type parameters

    • T: object | ArrayLike<unknown>
    • Predicate: (__namedParameters: [key: keyof T, value: T[keyof T]]) => boolean

    Parameters

    • obj: T

      The object to take the properties from.

    • predicate: Predicate

      The function that must hold true for the property to be excluded.

    Returns Partial<T>

    The constructed object.