@alwatr/deep-clone 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +1 -1
- package/dist/main.cjs +37 -2
- package/dist/main.cjs.map +2 -2
- package/dist/main.mjs +13 -2
- package/dist/main.mjs.map +2 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.3](https://github.com/Alwatr/nanolib/compare/@alwatr/deep-clone@1.1.2...@alwatr/deep-clone@1.1.3) (2024-10-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @alwatr/deep-clone
|
|
9
|
+
|
|
10
|
+
## [1.1.2](https://github.com/Alwatr/nanolib/compare/@alwatr/deep-clone@1.1.1...@alwatr/deep-clone@1.1.2) (2024-10-10)
|
|
11
|
+
|
|
12
|
+
### Dependencies update
|
|
13
|
+
|
|
14
|
+
* bump the development-dependencies group with 10 updates ([fa4aaf0](https://github.com/Alwatr/nanolib/commit/fa4aaf04c907ecae06aa14000ce35216170c15ad)) by @dependabot[bot]
|
|
15
|
+
|
|
6
16
|
## [1.1.1](https://github.com/Alwatr/nanolib/compare/@alwatr/deep-clone@1.1.0...@alwatr/deep-clone@1.1.1) (2024-10-08)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @alwatr/deep-clone
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ console.log(obj1.b.c); // 2
|
|
|
29
29
|
|
|
30
30
|
## Sponsors
|
|
31
31
|
|
|
32
|
-
The following companies, organizations, and individuals support
|
|
32
|
+
The following companies, organizations, and individuals support Nanolib ongoing maintenance and development. Become a Sponsor to get your logo on our README and website.
|
|
33
33
|
|
|
34
34
|
[](https://exirstudio.com)
|
|
35
35
|
|
package/dist/main.cjs
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
/* @alwatr/deep-clone v1.1.
|
|
2
|
-
"use strict";
|
|
1
|
+
/* @alwatr/deep-clone v1.1.3 */
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/main.ts
|
|
22
|
+
var main_exports = {};
|
|
23
|
+
__export(main_exports, {
|
|
24
|
+
deepClone: () => deepClone
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(main_exports);
|
|
27
|
+
var import_package_tracer = require("@alwatr/package-tracer");
|
|
28
|
+
import_package_tracer.packageTracer.add("@alwatr/deep-clone", "1.1.3");
|
|
29
|
+
function deepClone(obj) {
|
|
30
|
+
if (obj == null) return null;
|
|
31
|
+
return JSON.parse(JSON.stringify(obj));
|
|
32
|
+
}
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
deepClone
|
|
36
|
+
});
|
|
37
|
+
/*! For license information please see main.cjs.LEGAL.txt */
|
|
3
38
|
//# sourceMappingURL=main.cjs.map
|
package/dist/main.cjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
4
|
"sourcesContent": ["import {packageTracer} from '@alwatr/package-tracer';\n\npackageTracer.add(__package_name__, __package_version__);\n\n/**\n * Clone deeply nested objects and arrays.\n *\n * @param obj The object to clone.\n * @returns A clone of the object.\n * @example\n * ```typescript\n * const obj2 = deepClone(obj1);\n * ```\n */\nexport function deepClone<T>(obj: T): T;\n\n/**\n * Clone deeply nested objects and arrays.\n *\n * if the object is null or undefined, it returns null.\n *\n * @param obj The object to clone.\n * @returns A clone of the object.\n * @example\n * ```typescript\n * const obj2 = deepClone(obj1);\n * ```\n */\nexport function deepClone<T>(obj: T | null | undefined): T | null;\n\nexport function deepClone<T>(obj: T | null | undefined): T | null {\n if (obj == null) return null;\n // I don`t know why structuredClone is slower than stringify! but I think its changes in the future.\n // if (typeof structuredClone === 'function') {\n // return structuredClone(obj);\n // }\n // else\n return JSON.parse(JSON.stringify(obj));\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA4B;AAE5B,oCAAc,IAAI,sBAAkB,OAAmB;AA4BhD,SAAS,UAAa,KAAqC;AAChE,MAAI,OAAO,KAAM,QAAO;AAMxB,SAAO,KAAK,MAAM,KAAK,UAAU,GAAG,CAAC;AACvC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/main.mjs
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
/* @alwatr/deep-clone v1.1.
|
|
2
|
-
|
|
1
|
+
/* @alwatr/deep-clone v1.1.3 */
|
|
2
|
+
|
|
3
|
+
// src/main.ts
|
|
4
|
+
import { packageTracer } from "@alwatr/package-tracer";
|
|
5
|
+
packageTracer.add("@alwatr/deep-clone", "1.1.3");
|
|
6
|
+
function deepClone(obj) {
|
|
7
|
+
if (obj == null) return null;
|
|
8
|
+
return JSON.parse(JSON.stringify(obj));
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
deepClone
|
|
12
|
+
};
|
|
13
|
+
/*! For license information please see main.mjs.LEGAL.txt */
|
|
3
14
|
//# sourceMappingURL=main.mjs.map
|
package/dist/main.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/main.ts"],
|
|
4
4
|
"sourcesContent": ["import {packageTracer} from '@alwatr/package-tracer';\n\npackageTracer.add(__package_name__, __package_version__);\n\n/**\n * Clone deeply nested objects and arrays.\n *\n * @param obj The object to clone.\n * @returns A clone of the object.\n * @example\n * ```typescript\n * const obj2 = deepClone(obj1);\n * ```\n */\nexport function deepClone<T>(obj: T): T;\n\n/**\n * Clone deeply nested objects and arrays.\n *\n * if the object is null or undefined, it returns null.\n *\n * @param obj The object to clone.\n * @returns A clone of the object.\n * @example\n * ```typescript\n * const obj2 = deepClone(obj1);\n * ```\n */\nexport function deepClone<T>(obj: T | null | undefined): T | null;\n\nexport function deepClone<T>(obj: T | null | undefined): T | null {\n if (obj == null) return null;\n // I don`t know why structuredClone is slower than stringify! but I think its changes in the future.\n // if (typeof structuredClone === 'function') {\n // return structuredClone(obj);\n // }\n // else\n return JSON.parse(JSON.stringify(obj));\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
5
|
+
"mappings": ";;;AAAA,SAAQ,qBAAoB;AAE5B,cAAc,IAAI,sBAAkB,OAAmB;AA4BhD,SAAS,UAAa,KAAqC;AAChE,MAAI,OAAO,KAAM,QAAO;AAMxB,SAAO,KAAK,MAAM,KAAK,UAAU,GAAG,CAAC;AACvC;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/deep-clone",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Clone deeply nested objects and arrays in JavaScript.",
|
|
5
5
|
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
|
|
6
6
|
"keywords": [
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
"clean": "rm -rfv dist *.tsbuildinfo"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@alwatr/package-tracer": "^1.0.
|
|
70
|
+
"@alwatr/package-tracer": "^1.0.3"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@alwatr/nano-build": "^
|
|
73
|
+
"@alwatr/nano-build": "^2.0.0",
|
|
74
74
|
"@alwatr/prettier-config": "^1.0.5",
|
|
75
|
-
"@alwatr/tsconfig-base": "^1.3.
|
|
76
|
-
"typescript": "^5.6.
|
|
75
|
+
"@alwatr/tsconfig-base": "^1.3.1",
|
|
76
|
+
"typescript": "^5.6.3"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "e0b3b4a47c02a395046982803b2e431c6ee3b0ab"
|
|
79
79
|
}
|