A wrapper of tj/debug for functional programming.
The only difference is debug-trace-fn return the first argument instead of return void, so you can use it in any places such as in an expression.
$ npm install debug-trace-fn
- require/import:
var Trace = require('debug-trace-fn');
or es6/typescript:
import * as Debug from 'debug-trace-fn';
- same usage as tj/debug
- in an expression:
x=y+z; // x=y+debug(z);
obj={a:100,b:200};
foo(obj.a);// foo(debug(obj).a);
- for functional programming:
import * as Trace from 'debug-trace-fn'
const trace = Trace('trace')
import * as R from 'ramda'
const f = R.compose(
f2,
trace,
f1
)
f1[1,2,3] //output: trace [ 1, 2, 3 ] +0ms