2020-10-26 02:57:23 +01:00
|
|
|
export function formatIPAddress(ipAddress: string): string {
|
|
|
|
const ipAddressComponents = ipAddress.split(':')
|
|
|
|
|
|
|
|
// Wipe out the port component
|
|
|
|
ipAddressComponents[ipAddressComponents.length - 1] = '';
|
|
|
|
|
|
|
|
let ip = ipAddressComponents.join(':')
|
|
|
|
ip = ip.slice(0, ip.length - 1)
|
2020-10-27 00:13:25 +01:00
|
|
|
if (ip === '[::1]' || ip === '127.0.0.1') {
|
2020-10-26 02:57:23 +01:00
|
|
|
return "Localhost"
|
|
|
|
}
|
|
|
|
|
|
|
|
return ip;
|
2020-10-28 08:53:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// check if obj is {}
|
|
|
|
export function isEmptyObject(obj) {
|
|
|
|
return Object.keys(obj).length === 0;
|
|
|
|
}
|