bunshin-clone 1.8.5 → 1.8.6
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/dist/index.cjs +5 -3
- package/dist/index.js +5 -3
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -42,9 +42,10 @@ function clone(value, settings, refs) {
|
|
|
42
42
|
return result;
|
|
43
43
|
}
|
|
44
44
|
if (value instanceof RegExp) {
|
|
45
|
-
const
|
|
45
|
+
const { source, flags, lastIndex } = value;
|
|
46
|
+
const result = new RegExp(source, flags);
|
|
46
47
|
refs.set(value, result);
|
|
47
|
-
result.lastIndex =
|
|
48
|
+
result.lastIndex = lastIndex;
|
|
48
49
|
return result;
|
|
49
50
|
}
|
|
50
51
|
if (value instanceof ArrayBuffer) {
|
|
@@ -63,7 +64,8 @@ function clone(value, settings, refs) {
|
|
|
63
64
|
return cloneError(value, settings, refs);
|
|
64
65
|
}
|
|
65
66
|
if (value instanceof Blob) {
|
|
66
|
-
const
|
|
67
|
+
const { size, type } = value;
|
|
68
|
+
const result = value.slice(0, size, type);
|
|
67
69
|
refs.set(value, result);
|
|
68
70
|
return result;
|
|
69
71
|
}
|
package/dist/index.js
CHANGED
|
@@ -40,9 +40,10 @@ function clone(value, settings, refs) {
|
|
|
40
40
|
return result;
|
|
41
41
|
}
|
|
42
42
|
if (value instanceof RegExp) {
|
|
43
|
-
const
|
|
43
|
+
const { source, flags, lastIndex } = value;
|
|
44
|
+
const result = new RegExp(source, flags);
|
|
44
45
|
refs.set(value, result);
|
|
45
|
-
result.lastIndex =
|
|
46
|
+
result.lastIndex = lastIndex;
|
|
46
47
|
return result;
|
|
47
48
|
}
|
|
48
49
|
if (value instanceof ArrayBuffer) {
|
|
@@ -61,7 +62,8 @@ function clone(value, settings, refs) {
|
|
|
61
62
|
return cloneError(value, settings, refs);
|
|
62
63
|
}
|
|
63
64
|
if (value instanceof Blob) {
|
|
64
|
-
const
|
|
65
|
+
const { size, type } = value;
|
|
66
|
+
const result = value.slice(0, size, type);
|
|
65
67
|
refs.set(value, result);
|
|
66
68
|
return result;
|
|
67
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bunshin-clone",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.6",
|
|
4
4
|
"description": "High-performance deep clone utility with descriptor support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
],
|
|
61
61
|
"scripts": {
|
|
62
62
|
"bench": "bun tsup & npm run bench:install & npm run bench:run & npm run bench:uninstall",
|
|
63
|
-
"bench:install": "npm i bunshin-clone-npm@npm:bunshin-clone
|
|
63
|
+
"bench:install": "npm i bunshin-clone-npm@npm:bunshin-clone lodash.clonedeep @types/lodash.clonedeep tinybench",
|
|
64
64
|
"bench:run": "node ./benchmark/run.ts",
|
|
65
|
-
"bench:uninstall": "npm un bunshin-clone-npm
|
|
65
|
+
"bench:uninstall": "npm un bunshin-clone-npm lodash.clonedeep @types/lodash.clonedeep tinybench",
|
|
66
66
|
"build": "tsup",
|
|
67
67
|
"lint": "tsc --noEmit",
|
|
68
68
|
"prepublishOnly": "npm run build",
|