One timer helper to change the structure ofoverlay definitions
This commit is contained in:
parent
ce6a112d77
commit
2bd23ac785
34
helper.ts
34
helper.ts
|
@ -11,4 +11,36 @@ Object.keys(overlayDefinitions).forEach((key) => {
|
||||||
filters = [...filters, filter];
|
filters = [...filters, filter];
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log({ overlayDefinitions, filters, json: JSON.stringify(filters) });
|
// One timer
|
||||||
|
|
||||||
|
const categories = ['hiking', 'cycling', 'vanlife'];
|
||||||
|
|
||||||
|
let overlays = {};
|
||||||
|
|
||||||
|
for (const category of categories) {
|
||||||
|
console.log({ caller: 'onetimer / category', category });
|
||||||
|
overlays[category] = {};
|
||||||
|
for (const tag of Object.keys(overlayDefinitions)) {
|
||||||
|
overlays[category][tag] = {};
|
||||||
|
for (const tagValue of Object.keys(overlayDefinitions[tag] || {})) {
|
||||||
|
const def = overlayDefinitions[tag][tagValue];
|
||||||
|
if (!!def[category]) {
|
||||||
|
overlays[category][tag][tagValue] = def[category];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log({
|
||||||
|
caller: 'onetimer / result',
|
||||||
|
overlays: JSON.stringify(overlays),
|
||||||
|
});
|
||||||
|
|
||||||
|
// End of one timer
|
||||||
|
|
||||||
|
console.log({
|
||||||
|
overlayDefinitions,
|
||||||
|
filters,
|
||||||
|
json: JSON.stringify(filters),
|
||||||
|
overlays: JSON.stringify(overlays),
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue