Add tests for tags, add check for duplicate names as layer ids, fix #393

This commit is contained in:
Pieter Vander Vennet 2021-07-12 11:44:55 +02:00
parent fa9313a3b7
commit 33e2dca7e4
7 changed files with 95 additions and 60 deletions

View file

@ -8,7 +8,7 @@ export class Or extends TagsFilter {
super();
this.or = or;
}
matchesProperties(properties: any): boolean {
for (const tagsFilter of this.or) {
if (tagsFilter.matchesProperties(properties)) {
@ -23,9 +23,7 @@ export class Or extends TagsFilter {
const choices = [];
for (const tagsFilter of this.or) {
const subChoices = tagsFilter.asOverpass();
for (const subChoice of subChoices) {
choices.push(subChoice)
}
choices.push(...subChoices)
}
return choices;
}

View file

@ -34,9 +34,9 @@ export class RegexTag extends TagsFilter {
asOverpass(): string[] {
if (typeof this.key === "string") {
return [`['${this.key}'${this.invert ? "!" : ""}~'${RegexTag.source(this.value)}']`];
return [`["${this.key}"${this.invert ? "!" : ""}~"${RegexTag.source(this.value)}"]`];
}
return [`[~'${this.key.source}'${this.invert ? "!" : ""}~'${RegexTag.source(this.value)}']`];
return [`[~"${this.key.source}"${this.invert ? "!" : ""}~"${RegexTag.source(this.value)}"]`];
}
isUsableAsAnswer(): boolean {