tamda
Version:
Practical functional programming library for TypeScript
28 lines (27 loc) • 999 B
TypeScript
/**
* Creates a new object with only properties `prop` from the `source` object.
* @param source Object to pick properties from.
* @param props Properties to pick from source object.
* @example
* const source = { id: 1, original: true };
* pick(source, 'id');
* // { id: 1 }
*/
export declare function pick<T extends object>(source: T, ...props: (keyof T)[]): Partial<T>;
/**
* Returns a function that
* creates a new object with only properties `prop` from the `source` object.
* @param props Properties to pick from source object.
* @example
* const source = { id: 1, original: true };
* const justId = pick('id');
* justId(source);
* // { id: 1 }
*/
export declare function pick<T extends object>(...props: (keyof T)[]): typeof deferred;
/**
* Creates a new object with only properties `prop` from the `source` object.
* @param source Object to pick properties from.
*/
declare function deferred<T extends object>(source: T): Partial<T>;
export {};