UNPKG

680 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.clone = clone;
4/**
5 * A simple clone function that also allows you to pass an "extend" object whose properties will be
6 * added to the cloned copy of the original object passed.
7 * @group Utils
8 */
9function clone(object, extend) {
10 // eslint-disable-next-line @typescript-eslint/no-explicit-any
11 const cloned = {};
12 for (const [key, value] of Object.entries(object)) {
13 cloned[key] = value;
14 }
15 if (extend) {
16 for (const [key, value] of Object.entries(extend)) {
17 cloned[key] = value;
18 }
19 }
20 return cloned;
21}
22//# sourceMappingURL=clone.js.map
\No newline at end of file