server: Fix build comparator preferring numeric comparators

This commit is contained in:
Elian Doran 2024-07-15 23:20:20 +03:00
parent 105aa3e5f8
commit eb39da19b3
No known key found for this signature in database

View File

@ -33,11 +33,8 @@ const numericComparators: Record<string, Comparator<number>> = {
function buildComparator(operator: string, comparedValue: string) { function buildComparator(operator: string, comparedValue: string) {
comparedValue = comparedValue.toLowerCase(); comparedValue = comparedValue.toLowerCase();
if (operator in numericComparators) { if (operator in numericComparators && !isNaN(+comparedValue)) {
const floatValue = parseFloat(comparedValue); return numericComparators[operator](parseFloat(comparedValue));
if (!isNaN(floatValue)) {
return numericComparators[operator](floatValue);
}
} }
if (operator in stringComparators) { if (operator in stringComparators) {