Pipes a value through a series of functions from left to right. Currently supports up to 10 functions.
The initial value to transform
Functions to apply sequentially
The final transformed value
import { equal } from "node:assert/strict";import { pipe } from "@clipboard-health/util-ts";const result = pipe( " hello world ", (s) => s.trim(), (s) => s.split(" "), (array) => array.map((word) => word.charAt(0).toUpperCase() + word.slice(1)), (array) => array.join(" "),);equal(result, "Hello World"); Copy
import { equal } from "node:assert/strict";import { pipe } from "@clipboard-health/util-ts";const result = pipe( " hello world ", (s) => s.trim(), (s) => s.split(" "), (array) => array.map((word) => word.charAt(0).toUpperCase() + word.slice(1)), (array) => array.join(" "),);equal(result, "Hello World");
Pipes a value through a series of functions from left to right. Currently supports up to 10 functions.
Param: a
The initial value to transform
Param: fs
Functions to apply sequentially
Returns
The final transformed value
Example