import { map } from "https://deno.land/x/fun@v2.0.0/promise.ts";
Create a new Promise by mapping over the result of an existing Promise. This is effectively Promise.then, but narrowed to non-promise returning functions. If the mapping function returns a Promise then the type for this function will be incorrect, as there is no way to create a Promise<Promise>.
Examples
Example 1
Example 1
import { wrap, map } from "./promise.ts";
import { pipe } from "./fn.ts";
const result = await pipe(
wrap(1),
map(n => n + 1),
); // 2