Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/domain_functions/src/composable/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/composable/index.ts";

Creates a single function out of a chain of multiple Composables. 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 { cf as C } from 'domain-functions'

const a = C.composable( ({ aNumber }: { aNumber: number }) => ({ aString: String(aNumber) }), ) const b = C.composable( ({ aString }: { aString: string }) => ({ aBoolean: aString == '1' }), ) const d = C.pipe(a, b) // ^? Composable<({ aNumber }: { aNumber: number }) => { aBoolean: boolean }>

Type Parameters

T extends [Composable, ...Composable[]]

Parameters

...fns: T & PipeArguments<T>