From 0a3fc483202ab8d6ae618b47322841638d623764 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Sat, 22 Sep 2018 14:38:12 +0300 Subject: [PATCH] Update and archive pipeLog --- snippets/pipeLog.md | 13 ------------- snippets_archive/pipeLog.md | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 13 deletions(-) delete mode 100644 snippets/pipeLog.md create mode 100644 snippets_archive/pipeLog.md diff --git a/snippets/pipeLog.md b/snippets/pipeLog.md deleted file mode 100644 index c106398b0..000000000 --- a/snippets/pipeLog.md +++ /dev/null @@ -1,13 +0,0 @@ -### 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. - -```js -const pipeLog = data => console.log(data) || data -``` - -```js -pipeLog(1); // logs `1` and returns `1` -``` diff --git a/snippets_archive/pipeLog.md b/snippets_archive/pipeLog.md new file mode 100644 index 000000000..972776b1f --- /dev/null +++ b/snippets_archive/pipeLog.md @@ -0,0 +1,15 @@ +### pipeLog + +Logs a value and returns it. + +Use `console.log` to log the supplied value, combined with the `||` operator to return it. + + + +```js +const pipeLog = data => console.log(data) || data; +``` + +```js +pipeLog(1); // logs `1` and returns `1` +```