UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

23 lines (21 loc) 627 B
import { dfdlT } from "@monstermann/dfdl"; import { cloneSet } from "@monstermann/remmi"; //#region src/set/clone.ts /** * `clone(target)` * * Creates a shallow copy of a `Set`, unless marked as mutable with `markAsMutable` inside a mutation context (see [@monstermann/remmi](https://michaelostermann.github.io/remmi/#clonearray-array)). * * ```ts * const original = new Set([1, 2, 3]); * const copy = clone(original); // Set { 1, 2, 3 } * ``` * * ```ts * const original = new Set([1, 2, 3]); * const copy = pipe(original, clone()); // Set { 1, 2, 3 } * ``` */ const clone = dfdlT(cloneSet, 1); //#endregion export { clone };