@visulima/deep-clone 3.0.1 → 3.0.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 +22 -1
- package/README.md +43 -43
- package/dist/handler.js +1 -1
- package/dist/index.js +1 -1
- package/dist/packem_shared/copyDataView-Ww3lwn8t.js +1 -0
- package/package.json +1 -1
- package/dist/packem_shared/copyDataView-EF9L1_xC.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## @visulima/deep-clone [3.0.3](https://github.com/visulima/visulima/compare/@visulima/deep-clone@3.0.2...@visulima/deep-clone@3.0.3) (2025-11-07)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* update TypeScript configurations and improve linting across multiple packages ([6f25ec7](https://github.com/visulima/visulima/commit/6f25ec7841da7246f8f9166efc5292a7089d37ee))
|
|
6
|
+
|
|
7
|
+
### Miscellaneous Chores
|
|
8
|
+
|
|
9
|
+
* update npm and pnpm configurations for monorepo optimization ([#564](https://github.com/visulima/visulima/issues/564)) ([5512b42](https://github.com/visulima/visulima/commit/5512b42f672c216b6a3c9e39035199a4ebd9a4b8))
|
|
10
|
+
|
|
11
|
+
## @visulima/deep-clone [3.0.2](https://github.com/visulima/visulima/compare/@visulima/deep-clone@3.0.1...@visulima/deep-clone@3.0.2) (2025-11-05)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* update dependencies across multiple packages ([36a47f2](https://github.com/visulima/visulima/commit/36a47f26d65d25a7b4d8371186710e7d0ab61a2b))
|
|
16
|
+
|
|
17
|
+
### Miscellaneous Chores
|
|
18
|
+
|
|
19
|
+
* update dependencies across multiple packages ([c526462](https://github.com/visulima/visulima/commit/c52646260c2ae8bbf85692e642f305f47a158d4e))
|
|
20
|
+
* update package dependencies and configurations ([7bfe7e7](https://github.com/visulima/visulima/commit/7bfe7e71869580900aab50efb064b4293994ed9a))
|
|
21
|
+
|
|
1
22
|
## @visulima/deep-clone [3.0.1](https://github.com/visulima/visulima/compare/@visulima/deep-clone@3.0.0...@visulima/deep-clone@3.0.1) (2025-10-21)
|
|
2
23
|
|
|
3
24
|
### Bug Fixes
|
|
@@ -19,7 +40,7 @@
|
|
|
19
40
|
### Bug Fixes
|
|
20
41
|
|
|
21
42
|
* Adjusted the node engine requirement to support versions 20.19 and above ([65d4848](https://github.com/visulima/visulima/commit/65d484883d7c5cb3b9d5984158f0176631f1da83))
|
|
22
|
-
* update @visulima/packem to 2.0.0-alpha.
|
|
43
|
+
* update @visulima/packem to 2.0.0-alpha.32 across multiple packages for improved compatibility ([27b346e](https://github.com/visulima/visulima/commit/27b346eaa1c0fb0e420d9a9824482028307f4249))
|
|
23
44
|
|
|
24
45
|
### Miscellaneous Chores
|
|
25
46
|
|
package/README.md
CHANGED
|
@@ -190,51 +190,51 @@ console.log(clean); // => {}
|
|
|
190
190
|
|
|
191
191
|
Performance comparison for shallow object cloning `{ a: "a", b: "b", c: "c" }`:
|
|
192
192
|
|
|
193
|
-
| Library
|
|
194
|
-
|
|
195
|
-
| **plain-object-clone**
|
|
196
|
-
| fast-copy
|
|
197
|
-
| rfdc - default
|
|
198
|
-
| deep-copy
|
|
199
|
-
| rfdc - proto
|
|
200
|
-
| nanoclone
|
|
201
|
-
| **@visulima/deep-clone - loose** | 3,551,940
|
|
202
|
-
| clone-deep
|
|
203
|
-
| nano-copy
|
|
204
|
-
| rfdc - circles and proto
|
|
205
|
-
| rfdc - circles
|
|
206
|
-
| ramda.clone
|
|
207
|
-
| lodash.clonedeep
|
|
208
|
-
| structured-clone
|
|
209
|
-
| @mfederczuk/deeptools
|
|
210
|
-
| @ungap/structured-clone
|
|
211
|
-
| fast-copy strict
|
|
212
|
-
| @visulima/deep-clone - strict
|
|
193
|
+
| Library | Operations/sec | Relative Performance |
|
|
194
|
+
| -------------------------------- | -------------- | -------------------- |
|
|
195
|
+
| **plain-object-clone** | 5,650,888 | **1.00x** (fastest) |
|
|
196
|
+
| fast-copy | 5,056,607 | 0.89x |
|
|
197
|
+
| rfdc - default | 4,674,249 | 0.83x |
|
|
198
|
+
| deep-copy | 4,522,595 | 0.80x |
|
|
199
|
+
| rfdc - proto | 4,371,388 | 0.77x |
|
|
200
|
+
| nanoclone | 4,282,256 | 0.76x |
|
|
201
|
+
| **@visulima/deep-clone - loose** | 3,551,940 | 0.63x |
|
|
202
|
+
| clone-deep | 3,740,025 | 0.66x |
|
|
203
|
+
| nano-copy | 3,673,002 | 0.65x |
|
|
204
|
+
| rfdc - circles and proto | 3,423,507 | 0.61x |
|
|
205
|
+
| rfdc - circles | 3,235,513 | 0.57x |
|
|
206
|
+
| ramda.clone | 2,514,785 | 0.44x |
|
|
207
|
+
| lodash.clonedeep | 2,236,361 | 0.40x |
|
|
208
|
+
| structured-clone | 1,503,190 | 0.27x |
|
|
209
|
+
| @mfederczuk/deeptools | 1,305,034 | 0.23x |
|
|
210
|
+
| @ungap/structured-clone | 1,231,364 | 0.22x |
|
|
211
|
+
| fast-copy strict | 1,196,932 | 0.21x |
|
|
212
|
+
| @visulima/deep-clone - strict | 930,414 | 0.16x |
|
|
213
213
|
|
|
214
214
|
### Deep Clone Performance
|
|
215
215
|
|
|
216
216
|
Performance comparison for deep object cloning (complex nested structure):
|
|
217
217
|
|
|
218
|
-
| Library
|
|
219
|
-
|
|
220
|
-
| **rfdc - proto**
|
|
221
|
-
| rfdc - default
|
|
222
|
-
| rfdc - circles
|
|
223
|
-
| rfdc - circles and proto
|
|
224
|
-
| nanoclone
|
|
225
|
-
| deep-copy
|
|
226
|
-
| plain-object-clone
|
|
227
|
-
| nano-copy
|
|
228
|
-
| fast-copy
|
|
229
|
-
| clone-deep
|
|
230
|
-
| **@visulima/deep-clone - loose** | 194,650
|
|
231
|
-
| lodash.clonedeep
|
|
232
|
-
| structured-clone
|
|
233
|
-
| @ungap/structured-clone
|
|
234
|
-
| ramda.clone
|
|
235
|
-
| fast-copy strict
|
|
236
|
-
| @visulima/deep-clone - strict
|
|
237
|
-
| @mfederczuk/deeptools
|
|
218
|
+
| Library | Operations/sec | Relative Performance |
|
|
219
|
+
| -------------------------------- | -------------- | -------------------- |
|
|
220
|
+
| **rfdc - proto** | 412,630 | **1.00x** (fastest) |
|
|
221
|
+
| rfdc - default | 400,110 | 0.97x |
|
|
222
|
+
| rfdc - circles | 369,861 | 0.90x |
|
|
223
|
+
| rfdc - circles and proto | 367,846 | 0.89x |
|
|
224
|
+
| nanoclone | 314,105 | 0.76x |
|
|
225
|
+
| deep-copy | 301,609 | 0.73x |
|
|
226
|
+
| plain-object-clone | 249,603 | 0.60x |
|
|
227
|
+
| nano-copy | 248,646 | 0.60x |
|
|
228
|
+
| fast-copy | 228,871 | 0.55x |
|
|
229
|
+
| clone-deep | 217,880 | 0.53x |
|
|
230
|
+
| **@visulima/deep-clone - loose** | 194,650 | 0.47x |
|
|
231
|
+
| lodash.clonedeep | 130,934 | 0.32x |
|
|
232
|
+
| structured-clone | 90,495 | 0.22x |
|
|
233
|
+
| @ungap/structured-clone | 88,710 | 0.21x |
|
|
234
|
+
| ramda.clone | 58,385 | 0.14x |
|
|
235
|
+
| fast-copy strict | 34,771 | 0.08x |
|
|
236
|
+
| @visulima/deep-clone - strict | 33,065 | 0.08x |
|
|
237
|
+
| @mfederczuk/deeptools | 15,357 | 0.04x |
|
|
238
238
|
|
|
239
239
|
### Important Notes
|
|
240
240
|
|
|
@@ -242,9 +242,9 @@ Performance comparison for deep object cloning (complex nested structure):
|
|
|
242
242
|
- **Loose mode** (default): Fast performance with standard cloning behavior
|
|
243
243
|
- **Strict mode**: Slower but clones all properties including non-enumerable ones and symbols
|
|
244
244
|
- Libraries like `plain-object-clone` and `fastest-json-copy` are faster but have significant limitations:
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
245
|
+
- Cannot handle circular references
|
|
246
|
+
- Treat complex objects (Date, Map, etc.) as plain objects
|
|
247
|
+
- Limited type support
|
|
248
248
|
- **rfdc** is very fast but has fewer features than @visulima/deep-clone
|
|
249
249
|
|
|
250
250
|
## Supported Node.js Versions
|
package/dist/handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{copyArrayLoose as t,copyArrayStrict as e}from"./packem_shared/copyArrayLoose-BEBF0PeG.js";import{default as c}from"./packem_shared/copyArrayBuffer-_dUBQIVn.js";import{default as y}from"./packem_shared/copyBlob-S-Z7ux38.js";import{default as x}from"./packem_shared/copyDataView-
|
|
1
|
+
import{copyArrayLoose as t,copyArrayStrict as e}from"./packem_shared/copyArrayLoose-BEBF0PeG.js";import{default as c}from"./packem_shared/copyArrayBuffer-_dUBQIVn.js";import{default as y}from"./packem_shared/copyBlob-S-Z7ux38.js";import{default as x}from"./packem_shared/copyDataView-Ww3lwn8t.js";import{default as s}from"./packem_shared/copyDate-b-cxY0ZF.js";import{default as i}from"./packem_shared/copyError-Bdcealjm.js";import{copyMapLoose as u,copyMapStrict as d}from"./packem_shared/copyMapLoose-BodEbKp7.js";import{copyObjectLoose as b,copyObjectStrict as A}from"./packem_shared/copyObjectLoose-C5x-tHKP.js";import{copyRegExpLoose as g,copyRegExpStrict as j}from"./packem_shared/copyRegExpLoose-Cio6jQWx.js";import{copySetLoose as D,copySetStrict as M}from"./packem_shared/copySetLoose-L-swSTFR.js";export{c as copyArrayBuffer,t as copyArrayLoose,e as copyArrayStrict,y as copyBlob,x as copyDataView,s as copyDate,i as copyError,u as copyMapLoose,d as copyMapStrict,b as copyObjectLoose,A as copyObjectStrict,g as copyRegExpLoose,j as copyRegExpStrict,D as copySetLoose,M as copySetStrict};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var b=Object.defineProperty;var p=(t,n)=>b(t,"name",{value:n,configurable:!0});import{copyArrayStrict as l,copyArrayLoose as A}from"./packem_shared/copyArrayLoose-BEBF0PeG.js";import d from"./packem_shared/copyArrayBuffer-_dUBQIVn.js";import S from"./packem_shared/copyBlob-S-Z7ux38.js";import h from"./packem_shared/copyDataView-Ww3lwn8t.js";import w from"./packem_shared/copyDate-b-cxY0ZF.js";import j from"./packem_shared/copyError-Bdcealjm.js";import{copyMapStrict as E,copyMapLoose as B}from"./packem_shared/copyMapLoose-BodEbKp7.js";import{copyObjectStrict as M,copyObjectLoose as g}from"./packem_shared/copyObjectLoose-C5x-tHKP.js";import{copyRegExpStrict as k,copyRegExpLoose as O}from"./packem_shared/copyRegExpLoose-Cio6jQWx.js";import{copySetStrict as T,copySetLoose as W}from"./packem_shared/copySetLoose-L-swSTFR.js";var v=Object.defineProperty,a=p((t,n)=>v(t,"name",{value:n,configurable:!0}),"t");const y=a(t=>typeof t=="object"&&t!==null||typeof t=="function","canValueHaveProperties"),x={Array:A,ArrayBuffer:d,Blob:S,DataView:h,Date:w,Error:j,Function:a((t,n)=>t,"Function"),Map:B,Object:g,Promise:a(t=>{throw new TypeError(`${t.constructor.name} objects cannot be cloned`)},"Promise"),RegExp:O,Set:W,SharedArrayBuffer:a((t,n)=>{throw new TypeError(`${t.constructor.name} objects cannot be cloned`)},"SharedArrayBuffer"),WeakMap:a(t=>{throw new TypeError(`${t.constructor.name} objects cannot be cloned`)},"WeakMap"),WeakSet:a(t=>{throw new TypeError(`${t.constructor.name} objects cannot be cloned`)},"WeakSet")},H=a((t,n)=>{if(!y(t))return t;const r={...x,...n?.strict?{Array:l,Map:E,Object:M,RegExp:k,Set:T}:{},...n?.handler};let c=new WeakMap;const f=a((e,o)=>{if(!y(e))return e;if(o.cache.has(e))return o.cache.get(e);if(Array.isArray(e))return r.Array(e,o);if(typeof e=="object"&&e.constructor===Object&&e.nodeType===void 0)return r.Object(e,o);if(e.nodeType!==void 0&&e.cloneNode!==void 0)return e.cloneNode(!0);if(e instanceof Date)return r.Date(e,o);if(e instanceof RegExp)return r.RegExp(e,o);if(e instanceof Map)return r.Map(e,o);if(e instanceof Set)return r.Set(e,o);if(e instanceof Error)return r.Error(e,o);if(e instanceof ArrayBuffer)return r.ArrayBuffer(e,o);if(e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Uint32Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array){const{buffer:i}=e;if(i instanceof SharedArrayBuffer)throw new TypeError("SharedArrayBuffer cannot be cloned");const u=r.ArrayBuffer(i,o),m=e.constructor;return new m(u,e.byteOffset,e.length)}if(e instanceof Blob)return r.Blob(e,o);if(e instanceof DataView)return r.DataView(e,o);if(e instanceof SharedArrayBuffer)return r.SharedArrayBuffer(e,o);if(e instanceof Promise)return r.Promise(e,o);if(e instanceof WeakMap)return r.WeakMap(e,o);if(e instanceof WeakSet)return r.WeakSet(e,o);if(typeof e=="function")return r.Function(e,o);if(typeof e=="object")return r.Object(e,o);throw new TypeError(`Type of ${typeof e} cannot be cloned`,e)},"clone"),s=f(t,{cache:c,clone:f});return c=null,s},"deepClone");export{H as deepClone};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=Object.defineProperty;var t=(e,r)=>n(e,"name",{value:r,configurable:!0});import f from"./copyArrayBuffer-_dUBQIVn.js";var o=Object.defineProperty,c=t((e,r)=>o(e,"name",{value:r,configurable:!0}),"f");const y=c(e=>{const{buffer:r}=e;if(r instanceof SharedArrayBuffer)throw new TypeError("SharedArrayBuffer cannot be cloned");const a=f(r);return new DataView(a,e.byteOffset,e.byteLength)},"copyDataView");export{y as default};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=Object.defineProperty;var r=(e,a)=>t(e,"name",{value:a,configurable:!0});import o from"./copyArrayBuffer-_dUBQIVn.js";var f=Object.defineProperty,i=r((e,a)=>f(e,"name",{value:a,configurable:!0}),"a");const c=i(e=>new DataView(o(e.buffer)),"copyDataView");export{c as default};
|