Skip to main content
Module

x/careful/mod.ts>pipe

Safe containerization of values for TypeScript
Latest
variable pipe
import { pipe } from "https://deno.land/x/careful@v0.1.0/mod.ts";

This pipe function that takes a value and a list of functions and returns the result of applying the value to the functions in order.

Examples

const add = (a: number) => a + 1; const multiply = (a: number) => a * 2; const divide = (a: number) => a / 2; const subtract = (a: number) => a - 1; const result = pipe( 1, add, multiply, divide, subtract, ); console.log(result); // 1

type

Pipe