@alwatr/deep-clone 1.0.0 → 1.0.2
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/package.json +6 -6
- package/CHANGELOG.md +0 -10
- package/demo/bench.mjs +0 -16
- package/dist/main.cjs +0 -3
- package/dist/main.cjs.map +0 -7
- package/dist/main.d.ts +0 -25
- package/dist/main.d.ts.map +0 -1
- package/dist/main.mjs +0 -3
- package/dist/main.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/deep-clone",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Clone deeply nested objects and arrays in JavaScript.",
|
|
5
5
|
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com>",
|
|
6
6
|
"keywords": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"files": [
|
|
28
|
-
"
|
|
28
|
+
"dist/**/*"
|
|
29
29
|
],
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"clean": "rm -rfv dist .tsbuildinfo"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@alwatr/nano-build": "^1.0.
|
|
59
|
-
"@alwatr/prettier-config": "^1.0.
|
|
60
|
-
"@alwatr/tsconfig-base": "^1.0.
|
|
58
|
+
"@alwatr/nano-build": "^1.0.2",
|
|
59
|
+
"@alwatr/prettier-config": "^1.0.2",
|
|
60
|
+
"@alwatr/tsconfig-base": "^1.0.2",
|
|
61
61
|
"typescript": "^5.3.3"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "0a3ee8e3534dbaf155c85a2d128720c799fc32cd"
|
|
64
64
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# 1.0.0 (2023-12-22)
|
|
7
|
-
|
|
8
|
-
### Features
|
|
9
|
-
|
|
10
|
-
* **deep-clone:** new package for deep clone obj/array ([9ac5379](https://github.com/Alwatr/nanolib/commit/9ac5379bd579b85d165a79b75bb782654167430d)) by @AliMD
|
package/demo/bench.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {deepClone} from '@alwatr/deep-clone';
|
|
2
|
-
|
|
3
|
-
const obj1 = {};
|
|
4
|
-
for (let i = 0; i < 100; i++) {
|
|
5
|
-
obj1[i] = { a: 1, b: { c: 2 } };
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
console.log('start');
|
|
9
|
-
|
|
10
|
-
const startTime = performance.now();
|
|
11
|
-
|
|
12
|
-
for (let i = 1; i <= 100_000; i++) {
|
|
13
|
-
const obj2 = deepClone(obj1);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
console.log(`Execution time: ${Math.round(performance.now() - startTime)}ms`);
|
package/dist/main.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/* @alwatr/deep-clone v1.0.0 */
|
|
2
|
-
"use strict";var o=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var d=(n,e)=>{for(var u in e)o(n,u,{get:e[u],enumerable:!0})},f=(n,e,u,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of T(e))!i.call(n,l)&&l!==u&&o(n,l,{get:()=>e[l],enumerable:!(r=t(e,l))||r.enumerable});return n};var p=n=>f(o({},"__esModule",{value:!0}),n);var x={};d(x,{deepClone:()=>c});module.exports=p(x);function c(n){return n==null?null:JSON.parse(JSON.stringify(n))}0&&(module.exports={deepClone});
|
|
3
|
-
//# sourceMappingURL=main.cjs.map
|
package/dist/main.cjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/main.ts"],
|
|
4
|
-
"sourcesContent": ["/**\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 return JSON.parse(JSON.stringify(obj));\n}\n"],
|
|
5
|
-
"mappings": ";yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAAA,eAAAC,EAAAH,GA0BO,SAASE,EAAaE,EAAqC,CAChE,OAAIA,GAAO,KAAa,KACjB,KAAK,MAAM,KAAK,UAAUA,CAAG,CAAC,CACvC",
|
|
6
|
-
"names": ["main_exports", "__export", "deepClone", "__toCommonJS", "obj"]
|
|
7
|
-
}
|
package/dist/main.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Clone deeply nested objects and arrays.
|
|
3
|
-
*
|
|
4
|
-
* @param obj The object to clone.
|
|
5
|
-
* @returns A clone of the object.
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* const obj2 = deepClone(obj1);
|
|
9
|
-
* ```
|
|
10
|
-
*/
|
|
11
|
-
export declare function deepClone<T>(obj: T): T;
|
|
12
|
-
/**
|
|
13
|
-
* Clone deeply nested objects and arrays.
|
|
14
|
-
*
|
|
15
|
-
* if the object is null or undefined, it returns null.
|
|
16
|
-
*
|
|
17
|
-
* @param obj The object to clone.
|
|
18
|
-
* @returns A clone of the object.
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const obj2 = deepClone(obj1);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function deepClone<T>(obj: T | null | undefined): T | null;
|
|
25
|
-
//# sourceMappingURL=main.d.ts.map
|
package/dist/main.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;AAExC;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC"}
|
package/dist/main.mjs
DELETED
package/dist/main.mjs.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/main.ts"],
|
|
4
|
-
"sourcesContent": ["/**\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 return JSON.parse(JSON.stringify(obj));\n}\n"],
|
|
5
|
-
"mappings": ";AA0BO,SAASA,EAAaC,EAAqC,CAChE,OAAIA,GAAO,KAAa,KACjB,KAAK,MAAM,KAAK,UAAUA,CAAG,CAAC,CACvC",
|
|
6
|
-
"names": ["deepClone", "obj"]
|
|
7
|
-
}
|