ramda-universal-trace
v1.0.2
Published
Trace function that works fine both in browser and node
Downloads
18
Readme
ramda-universal-trace
Trace function that works fine both in browser and node
In browser it will use
console.log(message, subject)
but in node:
const options = { showHidden: true, depth: 40, colors: true }
console.log(message, util.inspect(subj, options))
Original idea was drawn from this gist
API
traceMeta = R.curryN(4, (logger, modFn, message, obj) => { ... })
traceMod = traceMeta(defaultLogger)
trace = traceMod(R.identity)
check source for more
Usage
import * as R from 'ramda'
import { trace, traceMod } from 'ramda-universal-trace'
const performComplexCalc = R.compose(
trace('after'),
R.subtract(__, 2),
R.divide(__, 4),
traceMod(R.prop('show_whats_on_this_key'), 'middle'),
R.multiply(10),
R.add(10),
trace('before')
)
Installation
npm i ramda-universal-trace
or yarn add ramda-universal-trace