-
Notifications
You must be signed in to change notification settings - Fork 0
curry
Subhajit Sahu edited this page Aug 7, 2022
·
1 revision
Generate curried version of a function.
Alternatives: curry, curryRight.
function curry(x, n)
// x: a function
// n: number of parameters [all]
const xasyncfn = require('extra-async-function');
var sub = (x: number, y: number) => x - y;
var fn = xasyncfn.curry(sub);
fn(2)(3); // sub(2, 3)
// → -1
var fn = xasyncfn.curry(Math.min, 3);
fn(5)(8)(3); // Math.min(5, 8, 3)
// → 3