@codady/utils 0.0.1 → 0.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/CHANGELOG.md +19 -0
- package/dist/utils.cjs.js +30 -1
- package/dist/utils.cjs.min.js +3 -3
- package/dist/utils.esm.js +30 -1
- package/dist/utils.esm.min.js +3 -3
- package/dist/utils.umd.js +30 -1
- package/dist/utils.umd.min.js +3 -3
- package/dist.zip +0 -0
- package/package.json +1 -1
- package/src/deepClone.js +1 -1
- package/src/deepClone.ts +1 -1
- package/src/deepCloneToJSON.js +47 -0
- package/src/deepCloneToJSON.ts +52 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All changes to Utils including new features, updates, and removals are documented here.
|
|
4
4
|
|
|
5
|
+
## [v0.0.2] - 2025-12-16
|
|
6
|
+
|
|
7
|
+
### Distribution Files
|
|
8
|
+
- **JS**: https://unpkg.com/@codady/utils@0.0.1/dist/js/utils.js
|
|
9
|
+
- **Zip**: https://unpkg.com/@codady/utils@0.0.1/dist.zip
|
|
10
|
+
|
|
11
|
+
### Changes
|
|
12
|
+
|
|
13
|
+
#### Fixed
|
|
14
|
+
- Some problems.
|
|
15
|
+
|
|
16
|
+
#### Added
|
|
17
|
+
- Null
|
|
18
|
+
|
|
19
|
+
#### Removed
|
|
20
|
+
- Null
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
5
24
|
## [v0.0.1] - 2025-12-15
|
|
6
25
|
|
|
7
26
|
### Distribution Files
|
package/dist/utils.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
|
-
* @since Last modified: 2025-12-16
|
|
3
|
+
* @since Last modified: 2025-12-16 14:44:11
|
|
4
4
|
* @name Utils for web front-end.
|
|
5
5
|
* @version 0.0.1
|
|
6
6
|
* @author AXUI development team <3217728223@qq.com>
|
|
@@ -74,6 +74,34 @@ const deepClone = (data) => {
|
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
+
const deepCloneToJSON = (data) => {
|
|
78
|
+
const dataType = getDataType(data);
|
|
79
|
+
// Handle objects
|
|
80
|
+
if (dataType === 'Object') {
|
|
81
|
+
const newObj = {};
|
|
82
|
+
// Clone regular properties
|
|
83
|
+
for (const key in data) {
|
|
84
|
+
newObj[key] = deepCloneToJSON(data[key]);
|
|
85
|
+
}
|
|
86
|
+
for (const key in newObj) {
|
|
87
|
+
newObj[key] === undefined && Reflect.deleteProperty(newObj, key);
|
|
88
|
+
}
|
|
89
|
+
return newObj;
|
|
90
|
+
// Handle arrays
|
|
91
|
+
}
|
|
92
|
+
else if (dataType === 'Array') {
|
|
93
|
+
let tmp = data.map((item, index) => deepCloneToJSON(item)).filter(item => item !== undefined);
|
|
94
|
+
return tmp;
|
|
95
|
+
// Handle Date objects
|
|
96
|
+
}
|
|
97
|
+
else if (!['Number', 'String', 'Boolean', 'Null'].includes(dataType)) {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
return data;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
77
105
|
const requireTypes = (data, require, cb) => {
|
|
78
106
|
// Normalize the input types (convert to array if it's a single type)
|
|
79
107
|
let requiredTypes = Array.isArray(require) ? require : [require], dataType = getDataType(data), typeLower = dataType.toLowerCase(),
|
|
@@ -108,6 +136,7 @@ const utils = {
|
|
|
108
136
|
//renderTpl,
|
|
109
137
|
//parseStr,
|
|
110
138
|
deepClone,
|
|
139
|
+
deepCloneToJSON
|
|
111
140
|
};
|
|
112
141
|
|
|
113
142
|
module.exports = utils;
|
package/dist/utils.cjs.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @since Last modified: 2025-
|
|
2
|
+
* @since Last modified: 2025-12-16 14:44:11
|
|
3
3
|
* @name Utils for web front-end.
|
|
4
|
-
* @version
|
|
4
|
+
* @version 0.0.1
|
|
5
5
|
* @author AXUI development team <3217728223@qq.com>
|
|
6
6
|
* @description This is a set of general-purpose JavaScript utility functions developed by the AXUI team. All functions are pure and do not involve CSS or other third-party libraries. They are suitable for any web front-end environment.
|
|
7
7
|
* @see {@link https://www.axui.cn|Official website}
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* @copyright This software supports the MIT License, allowing free learning and commercial use, but please retain the terms 'ax,' 'axui,' 'AX,' and 'AXUI' within the software.
|
|
13
13
|
* @license MIT license
|
|
14
14
|
*/
|
|
15
|
-
"use strict";const getDataType=e=>{let t,r=Object.prototype.toString.call(e).slice(8,-1);return t="Function"===r&&/^\s*class\s+/.test(e.toString())?"Class":"Object"===r&&Object.getPrototypeOf(e)!==Object.prototype?"Instance":r,t},
|
|
15
|
+
"use strict";const getDataType=e=>{let t,r=Object.prototype.toString.call(e).slice(8,-1);return t="Function"===r&&/^\s*class\s+/.test(e.toString())?"Class":"Object"===r&&Object.getPrototypeOf(e)!==Object.prototype?"Instance":r,t},deepClone=e=>{const t=getDataType(e);if("Object"===t){const t={},r=Object.getOwnPropertySymbols(e);for(const r in e)t[r]=deepClone(e[r]);if(r.length>0)for(const o of r)t[o]=deepClone(e[o]);return t}if("Array"===t)return e.map(e=>deepClone(e));if("Date"===t)return new Date(e.getTime());if("RegExp"===t){const t=e;return new RegExp(t.source,t.flags)}return e},deepCloneToJSON=e=>{const t=getDataType(e);if("Object"===t){const t={};for(const r in e)t[r]=deepCloneToJSON(e[r]);for(const e in t)void 0===t[e]&&Reflect.deleteProperty(t,e);return t}if("Array"===t){return e.map((e,t)=>deepCloneToJSON(e)).filter(e=>void 0!==e)}return["Number","String","Boolean","Null"].includes(t)?e:void 0},requireTypes=(e,t,r)=>{let o=Array.isArray(t)?t:[t],n=getDataType(e),s=n.toLowerCase(),p=o.map(e=>e.toLowerCase()),l=s.includes("html")?"element":s;if(r)try{if(!p.includes(l))throw new TypeError(`Expected data type(s): [${p.join(", ")}], but got: ${l}`)}catch(e){r(e,n)}else if(!p.includes(l))throw new TypeError(`Expected data type(s): [${p.join(", ")}], but got: ${l}`);return n},utils={getDataType:getDataType,requireTypes:requireTypes,deepClone:deepClone,deepCloneToJSON:deepCloneToJSON};module.exports=utils;
|
package/dist/utils.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
|
-
* @since Last modified: 2025-12-16
|
|
3
|
+
* @since Last modified: 2025-12-16 14:44:11
|
|
4
4
|
* @name Utils for web front-end.
|
|
5
5
|
* @version 0.0.1
|
|
6
6
|
* @author AXUI development team <3217728223@qq.com>
|
|
@@ -72,6 +72,34 @@ const deepClone = (data) => {
|
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
const deepCloneToJSON = (data) => {
|
|
76
|
+
const dataType = getDataType(data);
|
|
77
|
+
// Handle objects
|
|
78
|
+
if (dataType === 'Object') {
|
|
79
|
+
const newObj = {};
|
|
80
|
+
// Clone regular properties
|
|
81
|
+
for (const key in data) {
|
|
82
|
+
newObj[key] = deepCloneToJSON(data[key]);
|
|
83
|
+
}
|
|
84
|
+
for (const key in newObj) {
|
|
85
|
+
newObj[key] === undefined && Reflect.deleteProperty(newObj, key);
|
|
86
|
+
}
|
|
87
|
+
return newObj;
|
|
88
|
+
// Handle arrays
|
|
89
|
+
}
|
|
90
|
+
else if (dataType === 'Array') {
|
|
91
|
+
let tmp = data.map((item, index) => deepCloneToJSON(item)).filter(item => item !== undefined);
|
|
92
|
+
return tmp;
|
|
93
|
+
// Handle Date objects
|
|
94
|
+
}
|
|
95
|
+
else if (!['Number', 'String', 'Boolean', 'Null'].includes(dataType)) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return data;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
75
103
|
const requireTypes = (data, require, cb) => {
|
|
76
104
|
// Normalize the input types (convert to array if it's a single type)
|
|
77
105
|
let requiredTypes = Array.isArray(require) ? require : [require], dataType = getDataType(data), typeLower = dataType.toLowerCase(),
|
|
@@ -106,6 +134,7 @@ const utils = {
|
|
|
106
134
|
//renderTpl,
|
|
107
135
|
//parseStr,
|
|
108
136
|
deepClone,
|
|
137
|
+
deepCloneToJSON
|
|
109
138
|
};
|
|
110
139
|
|
|
111
140
|
export { utils as default };
|
package/dist/utils.esm.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @since Last modified: 2025-
|
|
2
|
+
* @since Last modified: 2025-12-16 14:44:11
|
|
3
3
|
* @name Utils for web front-end.
|
|
4
|
-
* @version
|
|
4
|
+
* @version 0.0.1
|
|
5
5
|
* @author AXUI development team <3217728223@qq.com>
|
|
6
6
|
* @description This is a set of general-purpose JavaScript utility functions developed by the AXUI team. All functions are pure and do not involve CSS or other third-party libraries. They are suitable for any web front-end environment.
|
|
7
7
|
* @see {@link https://www.axui.cn|Official website}
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* @copyright This software supports the MIT License, allowing free learning and commercial use, but please retain the terms 'ax,' 'axui,' 'AX,' and 'AXUI' within the software.
|
|
13
13
|
* @license MIT license
|
|
14
14
|
*/
|
|
15
|
-
const getDataType=e=>{let t,r=Object.prototype.toString.call(e).slice(8,-1);return t="Function"===r&&/^\s*class\s+/.test(e.toString())?"Class":"Object"===r&&Object.getPrototypeOf(e)!==Object.prototype?"Instance":r,t},
|
|
15
|
+
const getDataType=e=>{let t,r=Object.prototype.toString.call(e).slice(8,-1);return t="Function"===r&&/^\s*class\s+/.test(e.toString())?"Class":"Object"===r&&Object.getPrototypeOf(e)!==Object.prototype?"Instance":r,t},deepClone=e=>{const t=getDataType(e);if("Object"===t){const t={},r=Object.getOwnPropertySymbols(e);for(const r in e)t[r]=deepClone(e[r]);if(r.length>0)for(const o of r)t[o]=deepClone(e[o]);return t}if("Array"===t)return e.map(e=>deepClone(e));if("Date"===t)return new Date(e.getTime());if("RegExp"===t){const t=e;return new RegExp(t.source,t.flags)}return e},deepCloneToJSON=e=>{const t=getDataType(e);if("Object"===t){const t={};for(const r in e)t[r]=deepCloneToJSON(e[r]);for(const e in t)void 0===t[e]&&Reflect.deleteProperty(t,e);return t}if("Array"===t){return e.map((e,t)=>deepCloneToJSON(e)).filter(e=>void 0!==e)}return["Number","String","Boolean","Null"].includes(t)?e:void 0},requireTypes=(e,t,r)=>{let o=Array.isArray(t)?t:[t],n=getDataType(e),p=n.toLowerCase(),s=o.map(e=>e.toLowerCase()),l=p.includes("html")?"element":p;if(r)try{if(!s.includes(l))throw new TypeError(`Expected data type(s): [${s.join(", ")}], but got: ${l}`)}catch(e){r(e,n)}else if(!s.includes(l))throw new TypeError(`Expected data type(s): [${s.join(", ")}], but got: ${l}`);return n},utils={getDataType:getDataType,requireTypes:requireTypes,deepClone:deepClone,deepCloneToJSON:deepCloneToJSON};export{utils as default};
|
package/dist/utils.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*!
|
|
3
|
-
* @since Last modified: 2025-12-16
|
|
3
|
+
* @since Last modified: 2025-12-16 14:44:11
|
|
4
4
|
* @name Utils for web front-end.
|
|
5
5
|
* @version 0.0.1
|
|
6
6
|
* @author AXUI development team <3217728223@qq.com>
|
|
@@ -78,6 +78,34 @@
|
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
const deepCloneToJSON = (data) => {
|
|
82
|
+
const dataType = getDataType(data);
|
|
83
|
+
// Handle objects
|
|
84
|
+
if (dataType === 'Object') {
|
|
85
|
+
const newObj = {};
|
|
86
|
+
// Clone regular properties
|
|
87
|
+
for (const key in data) {
|
|
88
|
+
newObj[key] = deepCloneToJSON(data[key]);
|
|
89
|
+
}
|
|
90
|
+
for (const key in newObj) {
|
|
91
|
+
newObj[key] === undefined && Reflect.deleteProperty(newObj, key);
|
|
92
|
+
}
|
|
93
|
+
return newObj;
|
|
94
|
+
// Handle arrays
|
|
95
|
+
}
|
|
96
|
+
else if (dataType === 'Array') {
|
|
97
|
+
let tmp = data.map((item, index) => deepCloneToJSON(item)).filter(item => item !== undefined);
|
|
98
|
+
return tmp;
|
|
99
|
+
// Handle Date objects
|
|
100
|
+
}
|
|
101
|
+
else if (!['Number', 'String', 'Boolean', 'Null'].includes(dataType)) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
return data;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
81
109
|
const requireTypes = (data, require, cb) => {
|
|
82
110
|
// Normalize the input types (convert to array if it's a single type)
|
|
83
111
|
let requiredTypes = Array.isArray(require) ? require : [require], dataType = getDataType(data), typeLower = dataType.toLowerCase(),
|
|
@@ -112,6 +140,7 @@
|
|
|
112
140
|
//renderTpl,
|
|
113
141
|
//parseStr,
|
|
114
142
|
deepClone,
|
|
143
|
+
deepCloneToJSON
|
|
115
144
|
};
|
|
116
145
|
|
|
117
146
|
return utils;
|
package/dist/utils.umd.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @since Last modified: 2025-
|
|
2
|
+
* @since Last modified: 2025-12-16 14:44:11
|
|
3
3
|
* @name Utils for web front-end.
|
|
4
|
-
* @version
|
|
4
|
+
* @version 0.0.1
|
|
5
5
|
* @author AXUI development team <3217728223@qq.com>
|
|
6
6
|
* @description This is a set of general-purpose JavaScript utility functions developed by the AXUI team. All functions are pure and do not involve CSS or other third-party libraries. They are suitable for any web front-end environment.
|
|
7
7
|
* @see {@link https://www.axui.cn|Official website}
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* @copyright This software supports the MIT License, allowing free learning and commercial use, but please retain the terms 'ax,' 'axui,' 'AX,' and 'AXUI' within the software.
|
|
13
13
|
* @license MIT license
|
|
14
14
|
*/
|
|
15
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(
|
|
15
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).utils=t()}(this,function(){"use strict";const getDataType=e=>{let t,r=Object.prototype.toString.call(e).slice(8,-1);return t="Function"===r&&/^\s*class\s+/.test(e.toString())?"Class":"Object"===r&&Object.getPrototypeOf(e)!==Object.prototype?"Instance":r,t},deepClone=e=>{const t=getDataType(e);if("Object"===t){const t={},r=Object.getOwnPropertySymbols(e);for(const r in e)t[r]=deepClone(e[r]);if(r.length>0)for(const o of r)t[o]=deepClone(e[o]);return t}if("Array"===t)return e.map(e=>deepClone(e));if("Date"===t)return new Date(e.getTime());if("RegExp"===t){const t=e;return new RegExp(t.source,t.flags)}return e},deepCloneToJSON=e=>{const t=getDataType(e);if("Object"===t){const t={};for(const r in e)t[r]=deepCloneToJSON(e[r]);for(const e in t)void 0===t[e]&&Reflect.deleteProperty(t,e);return t}if("Array"===t){return e.map((e,t)=>deepCloneToJSON(e)).filter(e=>void 0!==e)}return["Number","String","Boolean","Null"].includes(t)?e:void 0};return{getDataType:getDataType,requireTypes:(e,t,r)=>{let o=Array.isArray(t)?t:[t],n=getDataType(e),i=n.toLowerCase(),s=o.map(e=>e.toLowerCase()),c=i.includes("html")?"element":i;if(r)try{if(!s.includes(c))throw new TypeError(`Expected data type(s): [${s.join(", ")}], but got: ${c}`)}catch(e){r(e,n)}else if(!s.includes(c))throw new TypeError(`Expected data type(s): [${s.join(", ")}], but got: ${c}`);return n},deepClone:deepClone,deepCloneToJSON:deepCloneToJSON}});
|
package/dist.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codady/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"author": "AXUI Development Team",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "This is a set of general-purpose JavaScript utility functions developed by the AXUI team. All functions are pure and do not involve CSS or other third-party libraries. They are suitable for any web front-end environment.",
|
package/src/deepClone.js
CHANGED
package/src/deepClone.ts
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since Last modified: 2025/12/16 14:43:51
|
|
3
|
+
* Deep clone an array or object to a JSON-compatible structure.
|
|
4
|
+
* Converts non-serializable types like functions, symbols, Date, RegExp to plain values.
|
|
5
|
+
*
|
|
6
|
+
* @template T
|
|
7
|
+
* @param {T} data - Array or object to clone
|
|
8
|
+
* @returns {T} - New object with different memory address, in a JSON-compatible structure
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const obj = { a: '', b: 0, c: [] };
|
|
12
|
+
* const cloned = deepCloneToJSON(obj);
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const arr = [{}, {}, {}];
|
|
16
|
+
* const cloned = deepCloneToJSON(arr);
|
|
17
|
+
*/
|
|
18
|
+
'use strict';
|
|
19
|
+
import getDataType from './getDataType';
|
|
20
|
+
const deepCloneToJSON = (data) => {
|
|
21
|
+
const dataType = getDataType(data);
|
|
22
|
+
// Handle objects
|
|
23
|
+
if (dataType === 'Object') {
|
|
24
|
+
const newObj = {};
|
|
25
|
+
// Clone regular properties
|
|
26
|
+
for (const key in data) {
|
|
27
|
+
newObj[key] = deepCloneToJSON(data[key]);
|
|
28
|
+
}
|
|
29
|
+
for (const key in newObj) {
|
|
30
|
+
newObj[key] === undefined && Reflect.deleteProperty(newObj, key);
|
|
31
|
+
}
|
|
32
|
+
return newObj;
|
|
33
|
+
// Handle arrays
|
|
34
|
+
}
|
|
35
|
+
else if (dataType === 'Array') {
|
|
36
|
+
let tmp = data.map((item, index) => deepCloneToJSON(item)).filter(item => item !== undefined);
|
|
37
|
+
return tmp;
|
|
38
|
+
// Handle Date objects
|
|
39
|
+
}
|
|
40
|
+
else if (!['Number', 'String', 'Boolean', 'Null'].includes(dataType)) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export default deepCloneToJSON;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since Last modified: 2025/12/16 14:43:51
|
|
3
|
+
* Deep clone an array or object to a JSON-compatible structure.
|
|
4
|
+
* Converts non-serializable types like functions, symbols, Date, RegExp to plain values.
|
|
5
|
+
*
|
|
6
|
+
* @template T
|
|
7
|
+
* @param {T} data - Array or object to clone
|
|
8
|
+
* @returns {T} - New object with different memory address, in a JSON-compatible structure
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const obj = { a: '', b: 0, c: [] };
|
|
12
|
+
* const cloned = deepCloneToJSON(obj);
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const arr = [{}, {}, {}];
|
|
16
|
+
* const cloned = deepCloneToJSON(arr);
|
|
17
|
+
*/
|
|
18
|
+
'use strict';
|
|
19
|
+
import getDataType from './getDataType';
|
|
20
|
+
|
|
21
|
+
const deepCloneToJSON = (data: Record<string, any>|Record<string, any>[]): any => {
|
|
22
|
+
const dataType = getDataType(data);
|
|
23
|
+
|
|
24
|
+
// Handle objects
|
|
25
|
+
if (dataType === 'Object') {
|
|
26
|
+
const newObj: Record<string, any> = {};
|
|
27
|
+
|
|
28
|
+
// Clone regular properties
|
|
29
|
+
for (const key in data) {
|
|
30
|
+
newObj[key] = deepCloneToJSON((data as any)[key]);
|
|
31
|
+
}
|
|
32
|
+
for(const key in newObj){
|
|
33
|
+
newObj[key] === undefined && Reflect.deleteProperty(newObj, key);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return newObj ;
|
|
37
|
+
|
|
38
|
+
// Handle arrays
|
|
39
|
+
} else if (dataType === 'Array') {
|
|
40
|
+
let tmp = (data as any[]).map((item, index) => deepCloneToJSON(item)).filter(item => item !== undefined);
|
|
41
|
+
return tmp;
|
|
42
|
+
// Handle Date objects
|
|
43
|
+
} else if (!['Number', 'String', 'Boolean', 'Null'].includes(dataType)) {
|
|
44
|
+
return undefined ;
|
|
45
|
+
} else {
|
|
46
|
+
return data;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default deepCloneToJSON;
|
|
52
|
+
|