Skip to content

composeRight

Subhajit Sahu edited this page Jul 29, 2022 · 2 revisions

Compose functions together, such that result is piped forward.

Alternatives: compose, composeRight.


function composeRight(...xs)
// xs: functions (f, g)
const xfunction = require('extra-function');


var fn = xfunction.composeRight(Math.abs, Math.sqrt);
fn(-64);  // Math.sqrt(Math.abs(-64))
// → 8

var fn = xfunction.composeRight(Math.min, Math.sqrt);
fn(22, 9);  // Math.sqrt(Math.min(22, 9))
// → 3


References

Clone this wiki locally