Pacote
    Preparing search index...

    Function flow

    • Composes functions into a new function that applies them from left to right.

      Type Parameters

      • A
      • B

      Parameters

      • ...fns: Compose1<A, B>

        Functions to apply in order.

      Returns Fn<A, B>

      A function that accepts the first input and returns the final result.

      import { flow } from '@pacote/pipe'

      const doubleSay = (value: string) => `${value}, ${value}`
      const capitalize = (value: string) =>
      value.charAt(0).toUpperCase() + value.slice(1)
      const exclaim = (value: string) => `${value}!`

      const transform = flow(doubleSay, capitalize, exclaim)
      transform('hello') // => 'Hello, hello!'
      // equivalent to (value) => exclaim(capitalize(doubleSay(value)))
    • Composes functions into a new function that applies them from left to right.

      Type Parameters

      • A
      • B
      • C

      Parameters

      • ...fns: Compose2<A, B, C>

        Functions to apply in order.

      Returns Fn<A, C>

      A function that accepts the first input and returns the final result.

      import { flow } from '@pacote/pipe'

      const doubleSay = (value: string) => `${value}, ${value}`
      const capitalize = (value: string) =>
      value.charAt(0).toUpperCase() + value.slice(1)
      const exclaim = (value: string) => `${value}!`

      const transform = flow(doubleSay, capitalize, exclaim)
      transform('hello') // => 'Hello, hello!'
      // equivalent to (value) => exclaim(capitalize(doubleSay(value)))
    • Composes functions into a new function that applies them from left to right.

      Type Parameters

      • A
      • B
      • C
      • D

      Parameters

      • ...fns: Compose3<A, B, C, D>

        Functions to apply in order.

      Returns Fn<A, D>

      A function that accepts the first input and returns the final result.

      import { flow } from '@pacote/pipe'

      const doubleSay = (value: string) => `${value}, ${value}`
      const capitalize = (value: string) =>
      value.charAt(0).toUpperCase() + value.slice(1)
      const exclaim = (value: string) => `${value}!`

      const transform = flow(doubleSay, capitalize, exclaim)
      transform('hello') // => 'Hello, hello!'
      // equivalent to (value) => exclaim(capitalize(doubleSay(value)))
    • Composes functions into a new function that applies them from left to right.

      Type Parameters

      • A
      • B
      • C
      • D
      • E

      Parameters

      • ...fns: Compose4<A, B, C, D, E>

        Functions to apply in order.

      Returns Fn<A, E>

      A function that accepts the first input and returns the final result.

      import { flow } from '@pacote/pipe'

      const doubleSay = (value: string) => `${value}, ${value}`
      const capitalize = (value: string) =>
      value.charAt(0).toUpperCase() + value.slice(1)
      const exclaim = (value: string) => `${value}!`

      const transform = flow(doubleSay, capitalize, exclaim)
      transform('hello') // => 'Hello, hello!'
      // equivalent to (value) => exclaim(capitalize(doubleSay(value)))
    • Composes functions into a new function that applies them from left to right.

      Type Parameters

      • A
      • B
      • C
      • D
      • E
      • F

      Parameters

      • ...fns: Compose5<A, B, C, D, E, F>

        Functions to apply in order.

      Returns Fn<A, F>

      A function that accepts the first input and returns the final result.

      import { flow } from '@pacote/pipe'

      const doubleSay = (value: string) => `${value}, ${value}`
      const capitalize = (value: string) =>
      value.charAt(0).toUpperCase() + value.slice(1)
      const exclaim = (value: string) => `${value}!`

      const transform = flow(doubleSay, capitalize, exclaim)
      transform('hello') // => 'Hello, hello!'
      // equivalent to (value) => exclaim(capitalize(doubleSay(value)))
    • Composes functions into a new function that applies them from left to right.

      Type Parameters

      • A
      • B
      • C
      • D
      • E
      • F
      • G

      Parameters

      • ...fns: Compose6<A, B, C, D, E, F, G>

        Functions to apply in order.

      Returns Fn<A, G>

      A function that accepts the first input and returns the final result.

      import { flow } from '@pacote/pipe'

      const doubleSay = (value: string) => `${value}, ${value}`
      const capitalize = (value: string) =>
      value.charAt(0).toUpperCase() + value.slice(1)
      const exclaim = (value: string) => `${value}!`

      const transform = flow(doubleSay, capitalize, exclaim)
      transform('hello') // => 'Hello, hello!'
      // equivalent to (value) => exclaim(capitalize(doubleSay(value)))
    • Composes functions into a new function that applies them from left to right.

      Type Parameters

      • A
      • B
      • C
      • D
      • E
      • F
      • G
      • H

      Parameters

      • ...fns: Compose7<A, B, C, D, E, F, G, H>

        Functions to apply in order.

      Returns Fn<A, H>

      A function that accepts the first input and returns the final result.

      import { flow } from '@pacote/pipe'

      const doubleSay = (value: string) => `${value}, ${value}`
      const capitalize = (value: string) =>
      value.charAt(0).toUpperCase() + value.slice(1)
      const exclaim = (value: string) => `${value}!`

      const transform = flow(doubleSay, capitalize, exclaim)
      transform('hello') // => 'Hello, hello!'
      // equivalent to (value) => exclaim(capitalize(doubleSay(value)))
    • Composes functions into a new function that applies them from left to right.

      Type Parameters

      • A
      • B
      • C
      • D
      • E
      • F
      • G
      • H
      • I

      Parameters

      • ...fns: Compose8<A, B, C, D, E, F, G, H, I>

        Functions to apply in order.

      Returns Fn<A, I>

      A function that accepts the first input and returns the final result.

      import { flow } from '@pacote/pipe'

      const doubleSay = (value: string) => `${value}, ${value}`
      const capitalize = (value: string) =>
      value.charAt(0).toUpperCase() + value.slice(1)
      const exclaim = (value: string) => `${value}!`

      const transform = flow(doubleSay, capitalize, exclaim)
      transform('hello') // => 'Hello, hello!'
      // equivalent to (value) => exclaim(capitalize(doubleSay(value)))