Add more improvements

This commit is contained in:
schmelczerandras 2020-09-16 14:45:08 +02:00
commit bc16bdd62e

View file

@ -0,0 +1,21 @@
export class Insights {
private static insights: any = {};
public static setValue(key: string | Array<string>, value: any): void {
if (Array.isArray(key)) {
key.reduce((previousValue, currentKey) => {
if (!Object.prototype.hasOwnProperty.call(previousValue, currentKey)) {
previousValue[currentKey] = {};
}
return previousValue[currentKey];
}, Insights.insights);
} else {
Insights.insights[key] = value;
}
}
public static get values(): any {
return Insights.insights;
}
}