47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import { overlayDefinitions } from './src/components/overlays/overlay-definitions';
|
|
|
|
let filters: any[] = ['any'];
|
|
|
|
Object.keys(overlayDefinitions).forEach((key) => {
|
|
const definition = overlayDefinitions[key];
|
|
let filter: any[] = ['in', key];
|
|
Object.keys(definition).forEach((subKey) => {
|
|
filter = [...filter, subKey];
|
|
});
|
|
filters = [...filters, filter];
|
|
});
|
|
|
|
// 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),
|
|
});
|