Value from pipeline
Side effect functions
value
Insert a side-effect into function pipeline.
This is used in situation where tap
is not suited,
such as map
Example:
const myResult = pass(result)
.to(tap, result => console.log('result before onOk/onErr', result))
.to(map, tapper(value => console.log('value before onOk', value)))
.to(mapErr, tapper(error => console.log('error before onErr', error)))
.to(map, onOk)
.to(map, tapper(value => console.log('value after onOk', value)))
.to(mapErr, onErr)
.to(mapErr, tapper(error => console.log('error after onErr', error)))
.get()
Side effect functions
A side-effect function that can be inserted into a pipeline
Generated using TypeDoc
Insert a side-effect into function pipeline
Example:
const result = pass(value) .to(tap, value => console.log('begin', value)) .to(inc) .to(tap, value => console.log('after inc', value)) .to(double) .to(tap, value => console.log('after double', value)) .to(square) .to(tap, value => console.log('after square', value)) .get()