A Babel transform plugin to name composition of functions.
For example when debugging the following code with Ramda:
const getValue = R.prop(
'value'
);
const getValues = R.map(
getValue
);
const calc = R.pipe(
R.unapply(R.identity),
getValues,
R.sum
);
calc(
{ value: 1 },
{ value: 2 },
undefined
);The call stack from browser is not very useful:
It would be easier to debug with variable names:
$ npm install babel-plugin-transform-function-composition-name.babelrc
{
"plugins": [
["transform-function-composition-name", {
"callee": "^R$",
"variable": "^(?!(construct))"
}]
]
}require("babel-core").transform("code", {
plugins: [
["transform-function-composition-name", {
// configure function composition to be transformed.
"callee": /^R$/, // optional function callee
"variable": /^(?!(construct))/ // optional variable name
}]
]
});
