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

@ -244,8 +244,8 @@ export class And extends TagsFilter {
}
}
for (let i = 0; i < optimized.length; i++){
const opt = optimized[i];
for (let i = 0; i < optimized.length; i++) {
const opt = optimized[i]
if (opt instanceof Tag) {
const k = opt.key
const v = properties[k]
@ -266,23 +266,24 @@ export class And extends TagsFilter {
if (v === undefined) {
continue
}
if(opt.invert){
if (opt.invert) {
// We should _not_ match this value
// If 'v' is given, we already know what value it should be
// If 'v' is the not-expected value, we have a conflict and return false
// Otherwise, we can safely drop this value
const doesMatch = (typeof opt.value === "string" && v === opt.value) ||
(v.match(<RegExp> opt.value) !== null)
const doesMatch =
(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
return false
}else{
} else {
optimized.splice(i, 1)
i--
}
}else if (v !== opt.value) {
} else if (v !== opt.value) {
// detected an internal conflict
return false
}