Composes multiple functions from right to left.
The type of input and output for all functions.
Rest
The functions to compose.
const trim = (s: string): string => s.trim();const toUpperCase = (s: string): string => s.toUpperCase();const exclaim = (s: string): string => `${s}!`;const composedFn = compose(exclaim, toUpperCase, trim);console.log(composedFn(" hello ")); // "HELLO!" Copy
const trim = (s: string): string => s.trim();const toUpperCase = (s: string): string => s.toUpperCase();const exclaim = (s: string): string => `${s}!`;const composedFn = compose(exclaim, toUpperCase, trim);console.log(composedFn(" hello ")); // "HELLO!"
Composes multiple functions from right to left.