@ionre/utils
Version:
utility functions
22 lines (21 loc) • 852 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.compose = function (f) { return function (g) { return function (a) { return f(g(a)); }; }; };
exports.composeAll = function (funcs) { return function (a) {
var x1 = a;
for (var i = funcs.length - 1; i >= 0; i--) {
x1 = funcs[i](x1);
}
return x1;
}; };
exports.effectify = function (f) { return function (arg) { return function () { return f(arg); }; }; };
exports.flip = function (f) { return function (b) { return function (a) { return f(a)(b); }; }; };
exports.pipe = function (g) { return function (f) { return function (a) { return f(g(a)); }; }; };
exports.pipeAll = function (funcs) { return function (a) {
var x1 = a;
var n = funcs.length;
for (var i = 0; i < n; i++) {
x1 = funcs[i](x1);
}
return x1;
}; };