-
Notifications
You must be signed in to change notification settings - Fork 0
compose
Subhajit Sahu edited this page Jul 29, 2022
·
2 revisions
Compose functions together, in applicative order.
Alternatives: compose, composeRight.
function compose(...xs)
// xs: functions (f, g)
const xfunction = require('extra-function');
var fn = xfunction.compose(Math.sqrt, Math.abs);
fn(-64); // Math.sqrt(Math.abs(-64))
// → 8
var fn = xfunction.compose(Math.sqrt, Math.min);
fn(22, 9); // Math.sqrt(Math.min(22, 9))
// → 3