Composes given functions (in the mathematical sense).
Unlike flow and pipe, functions passed to compose are applied (called) from last to first.
const f = (x: number): number => x * x;
const g = (x: number): string => x.toFixed();
const h = (x: string): boolean => x === '4';
compose(
h, // 3. true
g, // 2. 4
f, // 1. 2
)(2) // 4. true
// gives same result as
h(g(f(2))) // true
Composes given functions (in the mathematical sense).
Unlike flow and pipe, functions passed to compose are applied (called) from last to first.
const f = (x: number): number => x * x;
const g = (x: number): string => x.toFixed();
const h = (x: string): boolean => x === '4';
compose(
h, // 3. true
g, // 2. 4
f, // 1. 2
)(2) // 4. true
// gives same result as
h(g(f(2))) // true
Composes given functions (in the mathematical sense).
Unlike flow and pipe, functions passed to compose are applied (called) from last to first.
const f = (x: number): number => x * x;
const g = (x: number): string => x.toFixed();
const h = (x: string): boolean => x === '4';
compose(
h, // 3. true
g, // 2. 4
f, // 1. 2
)(2) // 4. true
// gives same result as
h(g(f(2))) // true
Composes given functions (in the mathematical sense).
Unlike flow and pipe, functions passed to compose are applied (called) from last to first.
const f = (x: number): number => x * x;
const g = (x: number): string => x.toFixed();
const h = (x: string): boolean => x === '4';
compose(
h, // 3. true
g, // 2. 4
f, // 1. 2
)(2) // 4. true
// gives same result as
h(g(f(2))) // true
Composes given functions (in the mathematical sense).
Unlike flow and pipe, functions passed to compose are applied (called) from last to first.
const f = (x: number): number => x * x;
const g = (x: number): string => x.toFixed();
const h = (x: string): boolean => x === '4';
compose(
h, // 3. true
g, // 2. 4
f, // 1. 2
)(2) // 4. true
// gives same result as
h(g(f(2))) // true
Composes given functions (in the mathematical sense).
Unlike flow and pipe, functions passed to compose are applied (called) from last to first.
const f = (x: number): number => x * x;
const g = (x: number): string => x.toFixed();
const h = (x: string): boolean => x === '4';
compose(
h, // 3. true
g, // 2. 4
f, // 1. 2
)(2) // 4. true
// gives same result as
h(g(f(2))) // true
Composes given functions (in the mathematical sense).
Unlike flow and pipe, functions passed to compose are applied (called) from last to first.
const f = (x: number): number => x * x;
const g = (x: number): string => x.toFixed();
const h = (x: string): boolean => x === '4';
compose(
h, // 3. true
g, // 2. 4
f, // 1. 2
)(2) // 4. true
// gives same result as
h(g(f(2))) // true
Composes given functions (in the mathematical sense).
Unlike flow and pipe, functions passed to compose are applied (called) from last to first.
const f = (x: number): number => x * x;
const g = (x: number): string => x.toFixed();
const h = (x: string): boolean => x === '4';
compose(
h, // 3. true
g, // 2. 4
f, // 1. 2
)(2) // 4. true
// gives same result as
h(g(f(2))) // true
Composes given functions (in the mathematical sense).
Unlike flow and pipe, functions passed to compose are applied (called) from last to first.
const f = (x: number): number => x * x;
const g = (x: number): string => x.toFixed();
const h = (x: string): boolean => x === '4';
compose(
h, // 3. true
g, // 2. 4
f, // 1. 2
)(2) // 4. true
// gives same result as
h(g(f(2))) // true
Generated using TypeDoc
Composes given functions (in the mathematical sense).
Unlike flow and pipe, functions passed to compose are applied (called) from last to first.