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/async_iterable.ts";

Chain AsyncIterable computations together.

@example
import { flatmap } from "./async_iterable.ts";
import { fromIterable } from "./async_iterable.ts";
import { pipe } from "./fn.ts";

const numbers = fromIterable([1, 2, 3]);
const expanded = pipe(
  numbers,
  flatmap(n => fromIterable([n, n * 2]))
);

for await (const value of expanded) {
  console.log(value); // 1, 2, 2, 4, 3, 6
}
function flatmap<A, I>(fati: (a: A) => AsyncIterable<I>): (ta: AsyncIterable<A>) => AsyncIterable<I>;
§
flatmap<A, I>(fati: (a: A) => AsyncIterable<I>): (ta: AsyncIterable<A>) => AsyncIterable<I>
[src]

§Type Parameters

§Parameters

§
fati: (a: A) => AsyncIterable<I>
[src]

§Return Type

§
(ta: AsyncIterable<A>) => AsyncIterable<I>
[src]