-
Notifications
You must be signed in to change notification settings - Fork 0
composeRight
Subhajit Sahu edited this page Aug 7, 2022
·
1 revision
Compose functions together, such that result is piped forward.
Alternatives: compose, composeRight.
function composeRight(...xs)
// xs: functions (f, g)
const xasyncfn = require('extra-async-function');
var fn = xasyncfn.composeRight(async x => Math.abs(x), Math.sqrt);
await fn(-64); // Math.sqrt(Math.abs(-64))
// → 8
var fn = xasyncfn.composeRight(Math.min, Math.sqrt);
await fn(22, 9); // Math.sqrt(Math.min(22, 9))
// → 3