Skip to content

omitBy

omitBy<T, Predicate>(obj, 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 extends object | ArrayLike<unknown>

Predicate extends (__namedParameters) => 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.