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>;