Skip to content

composeRight

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

Compose functions together, such that result is piped forward.

Alternatives: [compose], composeRight.


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


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

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


References

Clone this wiki locally