Filters object properties based on a predicate function. Only includes properties where the predicate returns true.
const isEven = (x: number) => x % 2 === 0;filterObject(isEven)({ a: 1, b: 2, c: 3, d: 4 });// => { b: 2, d: 4 } Copy
const isEven = (x: number) => x % 2 === 0;filterObject(isEven)({ a: 1, b: 2, c: 3, d: 4 });// => { b: 2, d: 4 }
Object value type
Function that returns true for values to include
New object with filtered properties
Filters object properties based on a predicate function. Only includes properties where the predicate returns true.
Example