diff --git a/resources/scripts/lib/formatters.ts b/resources/scripts/lib/formatters.ts index 66e4ea646..c15cc3d6b 100644 --- a/resources/scripts/lib/formatters.ts +++ b/resources/scripts/lib/formatters.ts @@ -8,7 +8,7 @@ function mbToBytes(megabytes: number): number { } /** - * Given an amount of bytes, converts them into a human readable string format + * Given an amount of bytes, converts them into a human-readable string format * using "1024" as the divisor. */ function bytesToString(bytes: number, decimals = 2): string { @@ -28,7 +28,7 @@ function bytesToString(bytes: number, decimals = 2): string { */ function ip(value: string): string { // noinspection RegExpSimplifiable - return /([a-f0-9:]+:+)+[a-f0-9]+/.test(value) ? `[${value}]` : value; + return /^([a-f0-9:]+:+)+[a-f0-9]+$/.test(value) ? `[${value}]` : value; } export { ip, mbToBytes, bytesToString };