DieselDepot-APP/node_modules/es-toolkit/dist/fp/object/pick.d.mts
SJCoetz def597c157 chore: add generated build artifacts and node module type files
add all Next.js build outputs and third-party dependency type declaration files
2026-07-20 01:18:42 +02:00

19 lines
No EOL
718 B
TypeScript

//#region src/fp/object/pick.d.ts
/**
* Creates a function that builds a new object containing only the given `keys`
* from the input object. Keys that are absent on the input are skipped. Use it
* with {@link pipe}.
*
* @template T - The type of the input object.
* @template K - The union of keys to pick.
* @param keys - The keys to copy into the new object.
* @returns A function that maps an object `T` to `Pick<T, K>`.
*
* @example
* import { pipe, pick } from 'es-toolkit/fp';
*
* pipe({ a: 1, b: 2, c: 3 }, pick(['a', 'c'])); // => { a: 1, c: 3 }
*/
declare function pick<T extends Record<string, any>, K extends keyof T>(keys: readonly K[]): (obj: T) => Pick<T, K>;
//#endregion
export { pick };