From d841f88a1351f66b719e7842d439f680d73d1d82 Mon Sep 17 00:00:00 2001 From: Filipe Dos Santos Mendes <3dos@users.noreply.github.com> Date: Mon, 20 Aug 2018 14:32:35 +0200 Subject: [PATCH 1/2] Create pipeLog.md --- snippets/pipeLog.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 snippets/pipeLog.md diff --git a/snippets/pipeLog.md b/snippets/pipeLog.md new file mode 100644 index 000000000..d28dfafdf --- /dev/null +++ b/snippets/pipeLog.md @@ -0,0 +1,13 @@ +### pipeLog + +Use `console.log` in a pipeline as this function simply encloses it and returns the passed value. + +Logs a value and returns it. + +```js +const pipeLog = data => console.log(data) || data +``` + +```js +pipeLog(1); // logs `1` and returns `1` +``` From a5e160c39b47151330ac2182868d8b9b7cbb8021 Mon Sep 17 00:00:00 2001 From: Felix Wu Date: Mon, 20 Aug 2018 15:09:02 +0200 Subject: [PATCH 2/2] Update pipeLog.md --- snippets/pipeLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/pipeLog.md b/snippets/pipeLog.md index d28dfafdf..c106398b0 100644 --- a/snippets/pipeLog.md +++ b/snippets/pipeLog.md @@ -1,6 +1,6 @@ ### pipeLog -Use `console.log` in a pipeline as this function simply encloses it and returns the passed value. +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.