Skip to content

clone

ts
function Set.clone<T>(target: ReadonlySet<T>): Set<T>

Returns a shallow copy of the set, unless marked as mutable with markAsMutable inside a mutation context (see @monstermann/remmi).

Example

ts
import { Set } from "@monstermann/set";

const original = Set.create([1, 2, 3]);
const copy = Set.clone(original); // Set { 1, 2, 3 }
ts
import { Set } from "@monstermann/set";

const original = Set.create([1, 2, 3]);
const copy = pipe(original, Set.clone()); // Set { 1, 2, 3 }