From 284c7d9d3062870181140f1acc1f4be72092e1d2 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Wed, 8 Apr 2026 19:04:34 +0300 Subject: [PATCH] Use Number.isFinite for input validation Replaces separate isNaN/null checks with a single Number.isFinite guard that also handles Infinity/-Infinity. --- ui-ngx/src/app/shared/pipe/short-number.pipe.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/shared/pipe/short-number.pipe.ts b/ui-ngx/src/app/shared/pipe/short-number.pipe.ts index ea57709688..fedf958067 100644 --- a/ui-ngx/src/app/shared/pipe/short-number.pipe.ts +++ b/ui-ngx/src/app/shared/pipe/short-number.pipe.ts @@ -28,9 +28,9 @@ export interface ShortNumberArgs { export class ShortNumberPipe implements PipeTransform { transform(number: number, args?: ShortNumberArgs): string { - if (isNaN(number)) return '0'; - if (number === null) return '0'; - if (number === 0) return '0'; + if (!Number.isFinite(number) || number === 0) { + return '0'; + } let abs = Math.abs(number); const rounder = Math.pow(10, 1); const isNegative = number < 0;