Basic usage

Chaining functions will cause them to execute one after another, passing the output from each function as the input to the next, returning the final output at the end of the chain.

import { chain } from 'radash'

const genesis = () => 0
const addFive = (num: number) => num + 5
const twoX = (num: number) => num * 2

const chained = chain(
  genesis,
  addFive,
  twoX
)

chained() // => 10

Testing

This _.chain function is 100% covered by tests. See them and contribute at GitHub.

Source

See the source for _.chain on GitHub.