@monstermann/fn
Version:
A utility library for TypeScript.
23 lines • 481 B
TypeScript
//#region src/function/tap.d.ts
/**
* `tap(fn)`
*
* Executes a function with the provided value and returns the original value unchanged.
*
* ```ts
* tap(5, (x) => console.log(x)); // logs 5, returns 5
* ```
*
* ```ts
* pipe(
* 5,
* tap((x) => console.log(x)),
* ); // logs 5, returns 5
* ```
*/
declare const tap: {
<T>(fn: (value: NoInfer<T>) => any): (target: T) => T;
<T>(target: T, fn: (value: NoInfer<T>) => any): T;
};
//#endregion
export { tap };