Skip to main content
Module

x/domain_functions/src/index.ts>pipe

Decouple your business logic from your framework. With first-class type inference from end to end.
Go to Latest
function pipe
import { pipe } from "https://deno.land/x/domain_functions@v2.6.0/src/index.ts";

Creates a single domain function out of a chain of multiple domain functions. It will pass the same environment to all given functions, and it will pass the output of a function as the next function's input in left-to-right order. The resulting data will be the output of the rightmost function.

Examples

import { mdf, pipe } from 'domain-functions'

const a = mdf(z.object({ aNumber: z.number() }))( ({ aNumber }) => ({ aString: String(aNumber) }), ) const b = mdf(z.object({ aString: z.string() }))( ({ aString }) => ({ aBoolean: aString == '1' }), ) const d = pipe(a, b) // ^? DomainFunction<{ aBoolean: boolean }>

Parameters

...fns: T