Files
30-seconds-of-code/snippets/pipeLog.md
30secondsofcode 0ed297997a Travis build: 503
2018-09-22 11:38:18 +00:00

352 B

pipeLog

Use console.log in a pipeline as this function simply encloses it and returns the passed value. This is especially useful for debugging when you want to log a variable's value before its usage.

Logs a value and returns it.

const pipeLog = data => console.log(data) || data;
pipeLog(1); // logs `1` and returns `1`