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

Chain computations by applying a function that returns an Iterable to each element, then flattening the results.

@example
import * as I from "./iterable.ts";

const numbers = I.wrap(1, 2, 3);
const expand = I.flatmap((n: number) => I.wrap(n, n * 2))(numbers);

const result = Array.from(expand); // [1, 2, 2, 4, 3, 6]
function flatmap<A, I>(fati: (a: A) => Iterable<I>): (ta: Iterable<A>) => Iterable<I>;
§
flatmap<A, I>(fati: (a: A) => Iterable<I>): (ta: Iterable<A>) => Iterable<I>
[src]

§Type Parameters

§Parameters

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

§Return Type

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