diff --git a/src/routes/stock-screener/workers/filterWorker.ts b/src/routes/stock-screener/workers/filterWorker.ts index e10125a6..058772e7 100644 --- a/src/routes/stock-screener/workers/filterWorker.ts +++ b/src/routes/stock-screener/workers/filterWorker.ts @@ -74,12 +74,12 @@ function convertUnitToValue(input: string | number | string[]) { if (nonNumericValues.has(lowerInput)) return input; // Handle percentage values - if (input.endsWith("%")) { - const numericValue = parseFloat(input.slice(0, -1)); // Remove '%' and convert to number + if (input?.endsWith("%")) { + const numericValue = parseFloat(input?.slice(0, -1)); // Remove '%' and convert to number if (isNaN(numericValue)) { return input; // Return original input if conversion fails } - return numericValue / 100; // Convert percentage to a decimal + return numericValue //numericValue / 100; // Convert percentage to a decimal } // Handle units (B, M, K)