# Module: filterObject
Returns a new object identical to the source
object, but without the entries for which the function fn
returns false.
import { filterByValue } from 'utilist';
filterByValue({ a: 1, b: 2, c: 3 }, (value) => value <= 2); // returns { a: 1, b: 2 }
# Functions
# filterByValue
▸ filterByValue‹T, K›(source
: T, fn
: function): any
Defined in src/filter-object.ts:20
Type parameters:
▪ T
▪ K: keyof T
Parameters:
▪ source: T
Object to filter.
▪ fn: function
Function used to filter each value. Needs to return a boolean.
▸ (value
: T[K]): boolean
Parameters:
Name | Type |
---|---|
value | T[K] |
Returns: any