Added outgoing notification

This commit is contained in:
eouia
2022-04-26 13:55:39 +02:00
parent 439690b981
commit df0f048ecc
3 changed files with 25 additions and 0 deletions

View File

@@ -146,6 +146,20 @@ class WeatherObject {
this.sunrise = moment(times.sunrise, "X");
this.sunset = moment(times.sunset, "X");
}
/**
* Clone to simple object to prevent mutating and deprecated legacy library.
*
* @return {object} simple object cloned.
*/
simpleClone() {
const toFlat = ["date", "sunrise", "sunset"];
let clone = { ...this };
for (const prop of toFlat) {
clone[prop] = clone?.[prop]?.valueOf() ?? clone?.[prop];
}
return clone;
}
}
/*************** DO NOT EDIT THE LINE BELOW ***************/