The goal of this plugin is to provide magic auto currying for all function like Elm does.
In
const add = function (a, b, c) { return a + b + c; }
const min = (a, b) => a - b;
add(1,2,3) === add(1,2)(3)
add(1,2,3) === add(1)(2,3)
add(1,2,3) === add(1)(2)(3)
min(1,2) === min(1)(2)
Out
const add = _magicCurrying(function add(a, b) {
return a + b;
});
const min = _magicCurrying((a, b) => a - b);
add(1,2,3) === add(1,2)(3)
add(1,2,3) === add(1)(2,3)
add(1,2,3) === add(1)(2)(3)
min(1,2) === min(1)(2)
$ npm install babel-plugin-transform-magic-currying
.babelrc
{
"plugins": ["transform-magic-currying"]
}
$ babel --plugins transform-magic-currying script.js
require("babel-core").transform("code", {
plugins: ["transform-magic-currying"]
});