1.0.2 • Published 6 years ago

ramda-universal-trace v1.0.2

Weekly downloads
17
License
MIT
Repository
github
Last release
6 years ago

Greenkeeper badge Build Status

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

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.4

6 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago