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

Given a function A -> ReadonlySet and a ReadonlySet return a ReadonlySet created by applying the function to every value A and joining all the resulting ReadonlySets.

@example
import * as S from "./set.ts";
import { pipe } from "./fn.ts";

const set = S.set(1, 2, 3, 4, 5);

const result = pipe(
  set,
  S.flatmap(n => S.set(n, n + 1, n + 2)),
); // Set(1, 2, 3, 4, 5, 6, 7);
function flatmap<A, I>(fati: (a: A) => ReadonlySet<I>): (ua: ReadonlySet<A>) => ReadonlySet<I>;
§
flatmap<A, I>(fati: (a: A) => ReadonlySet<I>): (ua: ReadonlySet<A>) => ReadonlySet<I>
[src]

§Type Parameters

§Parameters

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

§Return Type

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