Skip to content

Commit dd064ba

Browse files
committed
Extract repeated value for better maintainability
1 parent 610fabd commit dd064ba

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

website/src/queries-logic.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,25 +346,26 @@ function updateFilterFunction() {
346346

347347
IS_USEFUL_FORK = (datum) => {
348348
for (const [attribute, { operator, value }] of Object.entries(conditionObj)) {
349+
const attrValue = datum[attribute];
349350
switch (operator) {
350351
case '>':
351-
if (datum[attribute] <= value)
352+
if (attrValue <= value)
352353
return false;
353354
break;
354355
case '>=':
355-
if (datum[attribute] < value)
356+
if (attrValue < value)
356357
return false;
357358
break;
358359
case '<':
359-
if (datum[attribute] >= value)
360+
if (attrValue >= value)
360361
return false;
361362
break;
362363
case '<=':
363-
if (datum[attribute] > value)
364+
if (attrValue > value)
364365
return false;
365366
break;
366367
case '=':
367-
if (datum[attribute] != value)
368+
if (attrValue != value)
368369
return false;
369370
break;
370371
}

0 commit comments

Comments
 (0)