Skip to main content
Module

x/domain_functions/mod.ts>toComposable

Types and functions to make composition easy and safe
Latest
function toComposable
Re-export
import { toComposable } from "https://deno.land/x/domain_functions@v3.0.0/mod.ts";

A functions that helps incremental migration from the legacy domain-functions library to the composable-functions. Both libraries can be installed simultaneously, but to mix and match functions in compositions using toComposable and fromComposable are necessary to ensure the error types are compatible. It will convert any DomainFunction into a Composable<(input?: unknown, environment?: unknown) => T>

Examples

Example 1

import * as DF from 'domain-functions'
import * as CF from 'composable-functions'
import { myDomainFunction } from 'domains'
import { myComposableFunction } from 'new-domains'

// mix and match Composable and DomainFunction
const allComposable = CF.all(DF.toComposable(myDomainFunction), myComposableFunction)
const allDomainFunction = CF.all(myDomainFunction, DF.fromComposable(myComposableFunction))

Returns

Future.Composable<(input?: unknown, environment?: unknown) => R>