typedash
Version:
modern, type-safe collection of utility functions
23 lines (22 loc) • 1.33 kB
TypeScript
import { t as KeysOfUnion } from "./KeysOfUnion-CRGM1li-.js";
import { t as Many } from "./Many-CC3hL8UU.js";
import { t as Maybe } from "./Maybe-pvX1mStM.js";
import { t as ObjectPredicate } from "./createObjectPredicate-BP5NLXCL.js";
//#region src/functions/pick/pick.d.ts
/**
* 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>;
//#endregion
export { pick as t };
//# sourceMappingURL=pick-awf6d4wF.d.ts.map