@routr/common 2.13.10 → 2.13.13
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/helper.js +18 -12
- package/package.json +2 -2
package/dist/helper.js
CHANGED
|
@@ -56,18 +56,24 @@ const types_1 = require("./types");
|
|
|
56
56
|
* @return {object} The deep copy of the source object.
|
|
57
57
|
*/
|
|
58
58
|
const deepCopy = (source) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
59
|
+
if (Array.isArray(source)) {
|
|
60
|
+
// Type assertion: we know the output is T if input is T
|
|
61
|
+
return source.map((item) => (0, exports.deepCopy)(item));
|
|
62
|
+
}
|
|
63
|
+
else if (source instanceof Date) {
|
|
64
|
+
return new Date(source.getTime());
|
|
65
|
+
}
|
|
66
|
+
else if (source && typeof source === "object") {
|
|
67
|
+
return Object.getOwnPropertyNames(source).reduce((o, prop) => {
|
|
68
|
+
Object.defineProperty(o, prop, Object.getOwnPropertyDescriptor(source, prop));
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
o[prop] = (0, exports.deepCopy)(source[prop]);
|
|
71
|
+
return o;
|
|
72
|
+
}, Object.create(Object.getPrototypeOf(source)));
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return source;
|
|
76
|
+
}
|
|
71
77
|
};
|
|
72
78
|
exports.deepCopy = deepCopy;
|
|
73
79
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/common",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.13",
|
|
4
4
|
"description": "Common package",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/js-yaml": "^4.0.5"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "de2b725c3a4363f7fe958d6d6ad9d416d6cc290c"
|
|
59
59
|
}
|