Skip to main content
Module

x/fun/set.ts>copy

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function copy
import { copy } from "https://deno.land/x/fun@v2.0.0-alpha.12/set.ts";

Copies an existing ReadonlySet into a new ReadonlySet, keeping references to the original members.

Examples

Example 1

import * as S from "./set.ts";

const original = S.set(1, 2, 3);
const copy = S.copy(original);

const result1 = original === copy; // false

const has = (value: number) => original.has(value) === copy.has(value);

const result2 = has(1); // true;
const result3 = has(10); // true;

Parameters

ua: ReadonlySet<A>

Returns

ReadonlySet<A>