mirror of
https://github.com/henrygd/beszel.git
synced 2025-12-17 02:36:17 +01:00
fix: update temperature and byte formatting functions to use loose equality checks (#1180)
This commit is contained in:
@@ -179,8 +179,8 @@ export function formatTemperature(celsius: number, unit?: Unit): { value: number
|
|||||||
if (!unit) {
|
if (!unit) {
|
||||||
unit = $userSettings.get().unitTemp || Unit.Celsius
|
unit = $userSettings.get().unitTemp || Unit.Celsius
|
||||||
}
|
}
|
||||||
// need loose equality check due to form data being strings
|
// biome-ignore lint/suspicious/noDoubleEquals: need loose equality check due to form data being strings
|
||||||
if (unit === Unit.Fahrenheit) {
|
if (unit == Unit.Fahrenheit) {
|
||||||
return {
|
return {
|
||||||
value: celsius * 1.8 + 32,
|
value: celsius * 1.8 + 32,
|
||||||
unit: "°F",
|
unit: "°F",
|
||||||
@@ -202,8 +202,8 @@ export function formatBytes(
|
|||||||
// Convert MB to bytes if isMegabytes is true
|
// Convert MB to bytes if isMegabytes is true
|
||||||
if (isMegabytes) size *= 1024 * 1024
|
if (isMegabytes) size *= 1024 * 1024
|
||||||
|
|
||||||
// need loose equality check due to form data being strings
|
// biome-ignore lint/suspicious/noDoubleEquals: need loose equality check due to form data being strings
|
||||||
if (unit === Unit.Bits) {
|
if (unit == Unit.Bits) {
|
||||||
const bits = size * 8
|
const bits = size * 8
|
||||||
const suffix = perSecond ? "ps" : ""
|
const suffix = perSecond ? "ps" : ""
|
||||||
if (bits < 1000) return { value: bits, unit: `b${suffix}` }
|
if (bits < 1000) return { value: bits, unit: `b${suffix}` }
|
||||||
|
|||||||
Reference in New Issue
Block a user