Improved ParseIPv6Address formatting

This commit is contained in:
Michael Rowley 2021-12-30 14:25:12 +00:00
parent 7af7b4df5e
commit 444065c926
2 changed files with 220 additions and 222 deletions

View file

@ -403,7 +403,7 @@ export function strToIpv6(ipStr, retArr=true) {
return ipStr;
}
let expandedStr = ipStr.substring(0, compactIndex); // 1234:5678::..
const insertOffset = compactIndex == 0 ? 1 : 0;
const insertOffset = compactIndex == 0;
const ipEnd = ipStr.substring(compactIndex + 1);
const missingChars = 39 - (expandedStr.length + ipEnd.length);
for (let i = insertOffset; i < missingChars + insertOffset; i++) {