import { compose } from "https://deno.land/x/fun@v2.0.0/fn.ts";
Compose two functions by taking the output of one and passing it to another. This is equivalent to the map function.
Examples
Example 1
Example 1
import { compose, pipe } from "./fn.ts";
const length = (s: string) => s.length;
const dup = (n: number) => n + n;
const composed = pipe(
length,
compose(dup),
);
const result1 = composed("Hello"); // 10
const result2 = composed(""); // 0