Formatting

This commit is contained in:
Pieter Vander Vennet 2023-06-01 14:40:54 +02:00
parent 39deec76d2
commit d2f4df3b60
5 changed files with 82 additions and 72 deletions

View file

@ -245,7 +245,7 @@ export class And extends TagsFilter {
} }
for (let i = 0; i < optimized.length; i++) { for (let i = 0; i < optimized.length; i++) {
const opt = optimized[i]; const opt = optimized[i]
if (opt instanceof Tag) { if (opt instanceof Tag) {
const k = opt.key const k = opt.key
const v = properties[k] const v = properties[k]
@ -272,8 +272,9 @@ export class And extends TagsFilter {
// If 'v' is the not-expected value, we have a conflict and return false // If 'v' is the not-expected value, we have a conflict and return false
// Otherwise, we can safely drop this value // Otherwise, we can safely drop this value
const doesMatch = (typeof opt.value === "string" && v === opt.value) || const doesMatch =
(v.match(<RegExp> opt.value) !== null) (typeof opt.value === "string" && v === opt.value) ||
v.match(<RegExp>opt.value) !== null
if (doesMatch) { if (doesMatch) {
// We have a conflict as 'opt' is inverted // We have a conflict as 'opt' is inverted

View file

@ -1,4 +1,14 @@
import {Concat, Conversion, DesugaringContext, DesugaringStep, Each, FirstOf, Fuse, On, SetDefault,} from "./Conversion" import {
Concat,
Conversion,
DesugaringContext,
DesugaringStep,
Each,
FirstOf,
Fuse,
On,
SetDefault,
} from "./Conversion"
import { LayerConfigJson } from "../Json/LayerConfigJson" import { LayerConfigJson } from "../Json/LayerConfigJson"
import { TagRenderingConfigJson } from "../Json/TagRenderingConfigJson" import { TagRenderingConfigJson } from "../Json/TagRenderingConfigJson"
import { Utils } from "../../../Utils" import { Utils } from "../../../Utils"
@ -161,7 +171,6 @@ class ExpandTagRendering extends Conversion<
} }
private lookup(name: string): TagRenderingConfigJson[] | undefined { private lookup(name: string): TagRenderingConfigJson[] | undefined {
const direct = this.directLookup(name) const direct = this.directLookup(name)
if (direct === undefined) { if (direct === undefined) {

View file

@ -58,7 +58,8 @@ export default class SourceConfig {
"Error at " + "Error at " +
context + context +
": the specified tags are conflicting with each other: they will never match anything at all.\n" + ": the specified tags are conflicting with each other: they will never match anything at all.\n" +
"\tThe offending tags are: "+params.osmTags.asHumanString(false, false, {})+ "\tThe offending tags are: " +
params.osmTags.asHumanString(false, false, {}) +
"\tThey optmize into 'false' " "\tThey optmize into 'false' "
) )
} }

View file

@ -76,7 +76,6 @@ describe("Tag optimalization", () => {
const opt = t.optimize() const opt = t.optimize()
expect(typeof opt !== "boolean").true expect(typeof opt !== "boolean").true
expect(TagUtils.toString(<TagsFilter>opt)).toBe("shop=sports") expect(TagUtils.toString(<TagsFilter>opt)).toBe("shop=sports")
}) })
it("should optimize nested ORs", () => { it("should optimize nested ORs", () => {