Update IP.mjs
This commit is contained in:
parent
c9504ac675
commit
67886c886d
@ -352,10 +352,7 @@ export function ipv4ToStr(ipInt) {
|
|||||||
export function strToIpv6(ipStr, retArr=true) {
|
export function strToIpv6(ipStr, retArr=true) {
|
||||||
if (retArr === false) {
|
if (retArr === false) {
|
||||||
// TODO: Expand address.
|
// TODO: Expand address.
|
||||||
if (ipStr.length % 2 === 1) {
|
return Number("0x" + ipStr.replace(/\:/g, ''));
|
||||||
ipStr = "0" + ipStr;
|
|
||||||
}
|
|
||||||
return Number("0x" + ipStr.replace(":", ""));
|
|
||||||
}
|
}
|
||||||
let j = 0;
|
let j = 0;
|
||||||
const blocks = ipStr.split(":"),
|
const blocks = ipStr.split(":"),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user