Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

flatmap

import { flatmap } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/promise.ts";

Create a new Promise by flatmaping over the result of an existing Promise. This is effectively Promise.then.

@example
import { wrap, flatmap } from "./promise.ts";
import { pipe } from "./fn.ts";

const result = await pipe(
  wrap(1),
  flatmap(n => wrap(n + 1)),
); // 2
function flatmap<A, I>(faui: (a: A) => Promise<I>): (ua: Promise<A>) => Promise<I>;
§
flatmap<A, I>(faui: (a: A) => Promise<I>): (ua: Promise<A>) => Promise<I>
[src]

§Type Parameters

§Parameters

§
faui: (a: A) => Promise<I>
[src]

§Return Type

§
(ua: Promise<A>) => Promise<I>
[src]