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

compact

import { compact } from "https://raw.githubusercontent.com/baetheus/fun/main/set.ts";

Given an instance of Comparable create a function that will take a ReadonlySet and return a new ReadonlySet where any members that are equal are deduplicated.

@example
import * as S from "./set.ts";
import * as N from "./number.ts";
import * as E from "./comparable.ts";

const eq = E.struct({ num: N.ComparableNumber });
const compact = S.compact(eq);

const set = S.set({ num: 1 }, { num: 1 }, { num: 2 });
// Set({ num: 1 }, { num: 1 }, { num: 2 })

const result = compact(set); // Set({ num: 1 }, { num: 2 })
function compact<A>(S: Comparable<A>): (ua: ReadonlySet<A>) => ReadonlySet<A>;
§
compact<A>(S: Comparable<A>): (ua: ReadonlySet<A>) => ReadonlySet<A>
[src]

§Type Parameters

§Parameters

§Return Type

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