@monstermann/fn
Version:
A utility library for TypeScript.
23 lines (21 loc) • 628 B
JavaScript
import { dfdlT } from "@monstermann/dfdl";
import { cloneObject } from "@monstermann/remmi";
//#region src/object/clone.ts
/**
* `clone(target)`
*
* Creates a shallow copy of an object, unless marked as mutable with `markAsMutable` inside a mutation context (see [@monstermann/remmi](https://michaelostermann.github.io/remmi/#clonearray-array)).
*
* ```ts
* const original = { a: 1, b: 2 };
* const copy = clone(original); // { a: 1, b: 2 }
* ```
*
* ```ts
* const original = { a: 1, b: 2 };
* const copy = pipe(original, clone()); // { a: 1, b: 2 }
* ```
*/
const clone = dfdlT(cloneObject, 1);
//#endregion
export { clone };