Skip to main

flow

flow

Combines all of the functions given into a single function. This function takes a value and will accumulatively call it against all of the given functions left-to-right. The result of calling a function with the accumulated value will be given to the next function, and the result of the last function will be returned. If there are no functions given, then the combined function will return the value passed to it.

Returns

A function which takes a value and will return the result of accumulatively calling the value against all of the functions given left-to-right.

Signature - util.ts#L105

function flow(): <T>(x: T) => T
function flow<T, R>(f1: (x: T) => R): (x: T) => R
function flow<T, A, R>(f1: (x: T) => A, f2: (x: A) => R): (x: T) => R
function flow<T, A, B, R>(
    f1: (x: T) => A,
    f2: (x: A) => B,
    f3: (x: B) => R,
): (x: T) => R
function flow<T, A, B, C, R>(
    f1: (x: T) => A,
    f2: (x: A) => B,
    f3: (x: B) => C,
    f4: (x: C) => R,
): (x: T) => R
function flow<T, A, B, C, D, R>(
    f1: (x: T) => A,
    f2: (x: A) => B,
    f3: (x: B) => C,
    f4: (x: C) => D,
    f5: (x: D) => R,
): (x: T) => R
function flow<T, A, B, C, D, E, R>(
    f1: (x: T) => A,
    f2: (x: A) => B,
    f3: (x: B) => C,
    f4: (x: C) => D,
    f5: (x: D) => E,
    f6: (x: E) => R,
): (x: T) => R
function flow<T, A, B, C, D, E, F, R>(
    f1: (x: T) => A,
    f2: (x: A) => B,
    f3: (x: B) => C,
    f4: (x: C) => D,
    f5: (x: D) => E,
    f6: (x: E) => F,
    f7: (x: F) => R,
): (x: T) => R
function flow<T, A, B, C, D, E, F, G, R>(
    f1: (x: T) => A,
    f2: (x: A) => B,
    f3: (x: B) => C,
    f4: (x: C) => D,
    f5: (x: D) => E,
    f6: (x: E) => F,
    f7: (x: F) => G,
    f8: (x: G) => R,
): (x: T) => R
function flow<T, A, B, C, D, E, F, G, H, R>(
    f1: (x: T) => A,
    f2: (x: A) => B,
    f3: (x: B) => C,
    f4: (x: C) => D,
    f5: (x: D) => E,
    f6: (x: E) => F,
    f7: (x: F) => G,
    f8: (x: G) => H,
    f9: (x: H) => R,
): (x: T) => R
function flow<T, A, B, C, D, E, F, G, H, R>(
    f1: (x: T) => A,
    f2: (x: A) => B,
    f3: (x: B) => C,
    f4: (x: C) => D,
    f5: (x: D) => E,
    f6: (x: E) => F,
    f7: (x: F) => G,
    f8: (x: G) => H,
    f9: (x: H) => R,
    ...funcs: Array<(x: any) => any>
): (x: T) => R
function flow<T>(...fns: Array<(x: T) => T>): (x: T) => T