Update and archive pipeLog
This commit is contained in:
@ -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`
|
|
||||||
```
|
|
||||||
15
snippets_archive/pipeLog.md
Normal file
15
snippets_archive/pipeLog.md
Normal file
@ -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`
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user