UNPKG

super-utils-plus

Version:

A superior alternative to Lodash with improved performance, TypeScript support, and developer experience

33 lines (32 loc) 927 B
/** * Creates an object composed of the picked object properties. * * @param object - The source object * @param paths - The property paths to pick * @returns The new object * * @example * ```ts * const object = { 'a': 1, 'b': 2, 'c': 3 }; * * pick(object, ['a', 'c']); * // => { 'a': 1, 'c': 3 } * ``` */ export declare function pick<T extends object, K extends keyof T>(object: T, paths: K[] | string[]): Pick<T, K>; /** * Creates an object composed of the object properties predicate returns truthy for. * * @param object - The source object * @param predicate - The function invoked per property * @returns The new object * * @example * ```ts * const object = { 'a': 1, 'b': 2, 'c': 3 }; * * pickBy(object, (value) => value < 3); * // => { 'a': 1, 'b': 2 } * ``` */ export declare function pickBy<T extends object>(object: T, predicate: (value: T[keyof T], key: string) => boolean): Partial<T>;