Fixed errors

This commit is contained in:
Michael Rowley 2021-12-30 01:54:20 +00:00
parent 200fbb2360
commit 9b2d2c65ca
2 changed files with 2 additions and 3 deletions

View file

@ -355,7 +355,7 @@ export function strToIpv6(ipStr, retArr=true) {
if (ipStr.length % 2 === 1) { if (ipStr.length % 2 === 1) {
ipStr = "0" + ipStr; ipStr = "0" + ipStr;
} }
return BigInt("0x" + ipStr.replace(":", "")); return Number("0x" + ipStr.replace(":", ""));
} }
let j = 0; let j = 0;
const blocks = ipStr.split(":"), const blocks = ipStr.split(":"),

View file

@ -116,8 +116,7 @@ class Sort extends Operation {
*/ */
static _ipv6Sort(a, b) { static _ipv6Sort(a, b) {
const ipLib = require("../lib/IP.mjs"); const ipLib = require("../lib/IP.mjs");
const numericalA = ipLib.strToIpv6(a, false), const numericalA = ipLib.strToIpv6(a, false), numericalB = ipLib.strToIpv6(b, false);
numericalB = ipLib.strToIpv6(b, false);
return numericalA < numericalB ? -1 : 1; return numericalA < numericalB ? -1 : 1;
} }