pragmatic-fp-ts
Version:
Opinionated functional programming library with easy use in mind
10 lines (7 loc) • 325 B
text/typescript
export function spy<A>(message: string, value: A): A;
export function spy(message: string): <A>(value: A) => A;
export function spy<A>(message: string, value?: A) {
if (arguments.length === 1) return (theValue: A) => spy(message, theValue);
console.log(`[${message || "spy"}]:`, typeof value, value);
return value;
}