UNPKG

@augment-vir/common

Version:

A collection of augments, helpers types, functions, and classes for any JavaScript environment.

23 lines (22 loc) 797 B
import { type CompleteValues } from '@augment-vir/core'; /** * Filters an object. Like * [`[].filter`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries) * but for objects. * * @category Object * @category Package : @augment-vir/common * @example * * ```ts * import {filterObject} from '@augment-vir'; * * filterObject({a: 1, b: 2, c: 3}, (key, value) => { * return value >= 2; * }); * // output is `{b: 2, c: 3}` * ``` * * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export declare function filterObject<ObjectGeneric>(inputObject: ObjectGeneric, callback: (key: keyof ObjectGeneric, value: CompleteValues<ObjectGeneric>, fullObject: ObjectGeneric) => boolean): Partial<ObjectGeneric>;