utility
Pipes the value of an expression into a pipeline of functions.
Examples
Section titled “Examples”import { expect } from "jsr:@std/expect"import { pipe } from '@jvlk/fp-tsm'
const len = (s: string): number => s.lengthconst double = (n: number): number => n * 2
// without pipeexpect(double(len('aaa'))).toBe(6)
// with pipeexpect(pipe('aaa', len, double)).toBe(6)
Performs left-to-right function composition. The first argument may have any arity, the remaining arguments must be unary.
Examples
Section titled “Examples”import { expect } from "jsr:@std/expect"import { flow } from '@jvlk/fp-tsm'
const len = (s: string): number => s.lengthconst double = (n: number): number => n * 2
const f = flow(len, double)
expect(f('aaa')).toEqual(6)
A set of utility functions for functional programming in TypeScript.