mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 13:44:12 +00:00
refactor: simplify string comparisons
This commit is contained in:
committed by
Carlos Valente
parent
39e012452b
commit
7f8dbbfa87
@@ -82,10 +82,13 @@ export function testConditions(
|
||||
switch (operator) {
|
||||
case 'equals':
|
||||
// handle the case where we are comparing boolean strings
|
||||
|
||||
if (typeof fieldValue === 'boolean') {
|
||||
return isBooleanEquals(fieldValue, lowerCasedValue);
|
||||
}
|
||||
// make string comparisons case insensitive
|
||||
if (typeof fieldValue === 'string') {
|
||||
return fieldValue.toLowerCase() === lowerCasedValue;
|
||||
}
|
||||
// overload the edge case where we use empty string to check if a value does not exist
|
||||
if (value === '' && fieldValue === undefined) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user