tamda
Version:
Practical functional programming library for TypeScript
20 lines (19 loc) • 749 B
TypeScript
/**
* Invokes a function `fn` with `source` as argument, then returns the `source` itself.
* @param source Argument to supply to `fn`.
* @param fn Function to invoke with `source`.
*/
export declare function tap<T>(source: T, fn: Tapper<T>): T;
/**
* Returns a function that
* invokes a function `fn` with `source` as argument, then returns the `source` itself.
* @param fn Function to invoke with `source`.
*/
export declare function tap<T>(fn: Tapper<T>):
/**
* Invokes a previously specified function `fn` with `source` as argument, then returns the `source` itself.
* @param source Argument to supply to `fn`.
*/
(source: Parameters<typeof fn>[0]) => T;
declare type Tapper<T> = (source: T) => unknown;
export {};