import { promise } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { flatmap } = promise;
Create a new Promise by flatmaping over the result of an existing Promise. This is effectively Promise.then.
Examples
Example 1
Example 1
import { wrap, flatmap } from "./promise.ts";
import { pipe } from "./fn.ts";
const result = await pipe(
wrap(1),
flatmap(n => wrap(n + 1)),
); // 2