MCPcopy
hub / github.com/autobrr/qui / getSpeedDisplay

Function getSpeedDisplay

web/src/components/query-builder/LeafCondition.tsx:304–313  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

302
303 // Speed handling - parse bytes/s to display value using tracked unit
304 const getSpeedDisplay = (): { value: string; unit: number } => {
305 // Check raw stored value to distinguish empty from "0"
306 if (condition.value == null || condition.value === "") {
307 return { value: "", unit: speedUnit };
308 }
309 const bytesPerSec = parseFloat(condition.value) || 0;
310 const display = bytesPerSec / speedUnit;
311 const decimals = DECIMALS_BY_SPEED_UNIT[speedUnit] ?? 2;
312 return { value: formatNumericInput(display, decimals), unit: speedUnit };
313 };
314
315 const speedDisplay = fieldType === "speed" ? getSpeedDisplay() : null;
316

Callers 1

LeafConditionFunction · 0.85

Calls 1

formatNumericInputFunction · 0.85

Tested by

no test coverage detected