Skip to content
Carlos De Dios edited this page Oct 20, 2015 · 1 revision

Description

Joins n functions to be called one after another in a left-associative manner when invoked.

Example

/* Regular Approach */

let addTwo = (v) => v + 2;
let timesTen = (v) => v * 10;
let minusThree = (v) => v - 3;

return minusThree(timesTen(addTwo(5)));

/* Compose Approach */

import { compose } from "functional-programming-utilities";

let addTwo = (v) => v + 2;
let timesTen = (v) => v * 10;
let minusThree = (v) => v - 3;

return compose(addTwo, timesTen, minusThree)(5);

Clone this wiki locally