@monstermann/fn
Version:
A utility library for TypeScript.
22 lines • 627 B
TypeScript
//#region src/set/clone.d.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 }
* ```
*/
declare const clone: {
(): <T>(target: ReadonlySet<T>) => Set<T>;
<T>(target: ReadonlySet<T>): Set<T>;
};
//#endregion
export { clone };