mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
parent
a0b444d6c4
commit
0e2da630d5
@ -21,6 +21,7 @@ _This release is scheduled to be released on 2024-01-01._
|
|||||||
|
|
||||||
- Fix the option eventClass on customEvents.
|
- Fix the option eventClass on customEvents.
|
||||||
- Fix yr API version in locationforecast call (#3227)
|
- Fix yr API version in locationforecast call (#3227)
|
||||||
|
- Fix cloneObject() function to respect RegExp (#3237)
|
||||||
|
|
||||||
## [2.25.0] - 2023-10-01
|
## [2.25.0] - 2023-10-01
|
||||||
|
|
||||||
|
@ -90,6 +90,10 @@ function cloneObject(obj) {
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (obj.constructor.name === "RegExp") {
|
||||||
|
return new RegExp(obj);
|
||||||
|
}
|
||||||
|
|
||||||
const temp = obj.constructor(); // give temp the original obj's constructor
|
const temp = obj.constructor(); // give temp the original obj's constructor
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
temp[key] = cloneObject(obj[key]);
|
temp[key] = cloneObject(obj[key]);
|
||||||
|
@ -49,6 +49,13 @@ describe("File js/class", () => {
|
|||||||
expect(obj).toBe(expected);
|
expect(obj).toBe(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should clone regex", () => {
|
||||||
|
const expected = /.*Magic/;
|
||||||
|
const obj = clone(expected);
|
||||||
|
expect(obj).toEqual(expected);
|
||||||
|
expect(expected === obj).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
it("should clone undefined", () => {
|
it("should clone undefined", () => {
|
||||||
const expected = undefined;
|
const expected = undefined;
|
||||||
const obj = clone(expected);
|
const obj = clone(expected);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user