Curry-this makes creating curryied function simple and expresive by invoking curry with the function bind syntax ::.
Apart from the expresive way of creating a curried function, the main feature are placeholders.
A placeholder (_) is a Symbol which allows to curry specific arguments of a function.
Install it: npm install --save curry-this
const {curry, _} = require('curry-this')();
// Got a simple function?
const plus = (
(a, b, c) => a + b + c
)::curry();
plus(1, 2, 3); //» 6
plus(1)(2, 3); //» 6
plus(1, 2)(3); //» 6
plus(1)(2)(3); //» 6// Got a monster function?
const {open} = require('fs');
const newScript = open::curry(_, 'w', 0755, _);
newScript('do-wonders.sh', (error, file) => {
// The `file` is ready.
});You can try this with babel-node. Make sure that you use the --stage=0 option.