babel-plugin-transform-function-composition-name
v0.1.4
Published
Babel Plugin to transform function composition to named function
Downloads
3
Maintainers
Readme
babel-plugin-transform-function-composition-name
A Babel transform plugin to name composition of functions.
Want to achieve
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:
Installation
$ npm install babel-plugin-transform-function-composition-name
Usage
Via .babelrc
(Recommended)
.babelrc
{
"plugins": [
["transform-function-composition-name", {
"callee": "^R$",
"variable": "^(?!(construct))"
}]
]
}
Via Node API
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
}]
]
});