UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

23 lines (22 loc) 445 B
//#region src/function/log.ts /** * `log(...args)` * * Logs the provided value along with optional arguments and returns the value unchanged. * * ```ts * log('debug:', 42); // logs "debug: 42", returns 42 * ``` * * ```ts * pipe(42, log("processing:"), (x) => x * 2); // logs "processing: 42", returns 84 * ``` */ function log(...args) { return function(value) { console.log(...args, value); return value; }; } //#endregion export { log };