common-stuff
    Preparing search index...

    Function compose

    • Perform right-to-left function composition.

      Type Parameters

      • T1
      • T2

      Parameters

      • op1: (input: T1) => T2

      Returns (input: T1) => T2

      const func = compose(
      arr => arr.map(v => v + 2)
      (arr: number[]) => arr.map(v => v * 2),
      )
      // [4, 6, 8, 10]
      //
    • Perform right-to-left function composition.

      Type Parameters

      • T1
      • T2
      • T3

      Parameters

      • op2: (input: T2) => T3
      • op1: (input: T1) => T2

      Returns (input: T1) => T3

      const func = compose(
      arr => arr.map(v => v + 2)
      (arr: number[]) => arr.map(v => v * 2),
      )
      // [4, 6, 8, 10]
      //
    • Perform right-to-left function composition.

      Type Parameters

      • T1
      • T2
      • T3
      • T4

      Parameters

      • op3: (input: T3) => T4
      • op2: (input: T2) => T3
      • op1: (input: T1) => T2

      Returns (input: T1) => T4

      const func = compose(
      arr => arr.map(v => v + 2)
      (arr: number[]) => arr.map(v => v * 2),
      )
      // [4, 6, 8, 10]
      //
    • Perform right-to-left function composition.

      Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5

      Parameters

      • op4: (input: T4) => T5
      • op3: (input: T3) => T4
      • op2: (input: T2) => T3
      • op1: (input: T1) => T2

      Returns (input: T1) => T5

      const func = compose(
      arr => arr.map(v => v + 2)
      (arr: number[]) => arr.map(v => v * 2),
      )
      // [4, 6, 8, 10]
      //
    • Perform right-to-left function composition.

      Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6

      Parameters

      • op5: (input: T5) => T6
      • op4: (input: T4) => T5
      • op3: (input: T3) => T4
      • op2: (input: T2) => T3
      • op1: (input: T1) => T2

      Returns (input: T1) => T6

      const func = compose(
      arr => arr.map(v => v + 2)
      (arr: number[]) => arr.map(v => v * 2),
      )
      // [4, 6, 8, 10]
      //
    • Perform right-to-left function composition.

      Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7

      Parameters

      • op6: (input: T6) => T7
      • op5: (input: T5) => T6
      • op4: (input: T4) => T5
      • op3: (input: T3) => T4
      • op2: (input: T2) => T3
      • op1: (input: T1) => T2

      Returns (input: T1) => T7

      const func = compose(
      arr => arr.map(v => v + 2)
      (arr: number[]) => arr.map(v => v * 2),
      )
      // [4, 6, 8, 10]
      //
    • Perform right-to-left function composition.

      Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8

      Parameters

      • op7: (input: T7) => T8
      • op6: (input: T6) => T7
      • op5: (input: T5) => T6
      • op4: (input: T4) => T5
      • op3: (input: T3) => T4
      • op2: (input: T2) => T3
      • op1: (input: T1) => T2

      Returns (input: T1) => T8

      const func = compose(
      arr => arr.map(v => v + 2)
      (arr: number[]) => arr.map(v => v * 2),
      )
      // [4, 6, 8, 10]
      //
    • Perform right-to-left function composition.

      Parameters

      • ...operations: ((value: unknown) => unknown)[]

      Returns (value: unknown) => unknown

      const func = compose(
      arr => arr.map(v => v + 2)
      (arr: number[]) => arr.map(v => v * 2),
      )
      // [4, 6, 8, 10]
      //