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

Description

Takes care of passing a value through multiple functions in a left-associative manner.

Example

/* Regular Approach */

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

let r1 = addTwo(5);
let r2 = timesTen(r1);
let r3 = MinusThree(r2);

return r3;

/* Pipe Approach */

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

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

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

Clone this wiki locally