ui: fix IPv6 formatting logic
This commit is contained in:
parent
42d8f2cb82
commit
76b67cb889
1 changed files with 2 additions and 2 deletions
|
@ -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.
|
* using "1024" as the divisor.
|
||||||
*/
|
*/
|
||||||
function bytesToString(bytes: number, decimals = 2): string {
|
function bytesToString(bytes: number, decimals = 2): string {
|
||||||
|
@ -28,7 +28,7 @@ function bytesToString(bytes: number, decimals = 2): string {
|
||||||
*/
|
*/
|
||||||
function ip(value: string): string {
|
function ip(value: string): string {
|
||||||
// noinspection RegExpSimplifiable
|
// 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 };
|
export { ip, mbToBytes, bytesToString };
|
||||||
|
|
Loading…
Reference in a new issue