typedash
Version:
modern, type-safe collection of utility functions
24 lines (21 loc) • 1.29 kB
text/typescript
import { K as KeysOfUnion } from '../KeysOfUnion-BrkZWXzm.cjs';
import { M as Many } from '../Many-Dnn8Ysh_.cjs';
import { M as Maybe } from '../Maybe-D6dwMjD9.cjs';
import { O as ObjectPredicate } from '../createObjectPredicate-2CUCZ3yY.cjs';
import '../CastToString-BoaHrryS.cjs';
import 'type-fest';
/**
* Returns a new object with only the specified properties from the input object.
* @param object The input object to pick properties from.
* @param properties An array of property names to pick from the input object.
* @returns A new object with only the specified properties from the input object.
*/
declare function pick<T extends object, const K extends keyof T | KeysOfUnion<T>>(object: Maybe<T>, properties: Many<K>): Pick<T, K>;
/**
* Returns a new object with only the properties that satisfy the predicate function from the input object.
* @param object The input object to pick properties from.
* @param predicate A function that takes a property value and its key and returns a boolean indicating whether to pick the property or not.
* @returns A new object with only the properties that satisfy the predicate function from the input object.
*/
declare function pick<T extends object>(object: Maybe<T>, predicate: ObjectPredicate<T>): Partial<T>;
export { pick };