Starting to implement a proper library for OSM tags

This commit is contained in:
Eric van der Vlist 2023-06-12 15:51:05 +02:00
parent a4e975dbeb
commit 3f56cf9c23
2 changed files with 42 additions and 0 deletions

11
src/lib/osm/tags.test.ts Normal file
View File

@ -0,0 +1,11 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { getTagStatus } from './tags';
describe('The getTagStatus function', () => {
it('should return false/false for a tag that does NOT exist', () => {
expect(getTagStatus('whatever', {}, '', '')).toEqual({
selected: false,
highlighted: false,
});
});
});

31
src/lib/osm/tags.ts Normal file
View File

@ -0,0 +1,31 @@
interface TagStatus {
selected: boolean;
highlighted: boolean;
}
interface TagFormatDefinition {}
interface TagCategoryDefinitions {
[key: string]: TagFormatDefinition;
}
interface TagActivityDefinitions {
[key: string]: TagCategoryDefinitions;
}
interface TagDefinitions {
[key: string]: TagActivityDefinitions;
}
export const getTagStatus = (
tag: string,
definitions: TagDefinitions,
selectedKey: string,
highlightedKey: string
) => {
let status: TagStatus = {
selected: false,
highlighted: false,
};
return status;
};