From eb5908d5d231ecd8bb48a5877f1decbbee0067a9 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 15 Jun 2021 10:15:43 +0100 Subject: [PATCH] fix tests --- src/filter-component.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/filter-component.ts b/src/filter-component.ts index 70c9e2f29..2d8f7eb51 100644 --- a/src/filter-component.ts +++ b/src/filter-component.ts @@ -102,25 +102,20 @@ export class FilterComponent { const name = Object.keys(literalKeys)[n]; const matchFunc = literalKeys[name]; const notName = "not_" + name; - const disallowedValues = this[notName]; - if (disallowedValues.filter(matchFunc).length > 0) { + const disallowedValues: string[] = this.filterJson[notName]; + if (disallowedValues?.some(matchFunc)) { return false; } - const allowedValues = this[name]; - if (allowedValues && allowedValues.length > 0) { - const anyMatch = allowedValues.some(matchFunc); - if (!anyMatch) { - return false; - } + const allowedValues: string[] = this.filterJson[name]; + if (allowedValues && !allowedValues.some(matchFunc)) { + return false; } } const containsUrlFilter = this.filterJson.contains_url; - if (containsUrlFilter !== undefined) { - if (containsUrlFilter !== containsUrl) { - return false; - } + if (containsUrlFilter !== undefined && containsUrlFilter !== containsUrl) { + return false; } return true;