Composes functions right-to-left. Inverse of pipe - functions are applied from right to left.
const add = (x: number) => x + 1;const multiply = (x: number) => x * 2;compose(add, multiply)(5);// => 11 (multiply(5) = 10, then add(10) = 11) Copy
const add = (x: number) => x + 1;const multiply = (x: number) => x * 2;compose(add, multiply)(5);// => 11 (multiply(5) = 10, then add(10) = 11)
Input and output type
Functions to compose
Composed function
Composes functions right-to-left. Inverse of pipe - functions are applied from right to left.
Example