a tool for adding clarity to your compositional-pipelines or just invoking side-effects in a clean way
Originally inspired by this book, this is a more fully-fledged solution for adding simple side-effects to a given operation.
Pass a value to a side effect function but return the original value
fn
Function a functiona
any anything
import {sideEffect} from 'xtrace'
import {pipe} from 'f-utility'
const multiplyByTwo = x => x * 2
const eventLog => { / * something async * / }
const multiplyByTwoAndNotify = pipe(
multiplyByTwo
sideEffect(eventLog)
)
Returns any a
Pass a value and a tag to a side effect function but return the value
fn
Function a functiona
any anythingb
any anything
Returns any b
Log a value and a tag but return the value
fn
Function a functiona
any something to logb
any some value
Returns any b
Pass a transformed value and a tag but return the value
Returns any b
Log a transformed value and a tag but return the value
fn
Function a transformer functiona
any anythingb
any anything
Returns any b