Comparing version 2.1.0 to 2.1.1
@@ -8,4 +8,2 @@ "use strict"; | ||
const debug = utils_1.createDebug("ipv6"); | ||
const FF = 0xffffffffffffffffn; | ||
const N64 = 64n; | ||
class Ipv6ToRegion { | ||
@@ -130,3 +128,3 @@ constructor(dbPath) { | ||
let first = ret.cArea.indexOf("国"); | ||
if (first >= 0) { | ||
if (first === 1) { | ||
first += 1; | ||
@@ -157,6 +155,6 @@ country = ret.cArea.slice(0, first); | ||
if (isCity != true) { | ||
for (let province of provinceArr) { | ||
second = ret.cArea.indexOf(province); | ||
for (let p of provinceArr) { | ||
second = ret.cArea.indexOf(p); | ||
if (second >= 0) { | ||
second = second + province.length; | ||
second = second + p.length; | ||
province = ret.cArea.slice(first, second); | ||
@@ -171,3 +169,3 @@ break; | ||
const city2 = ret.cArea.indexOf("州"); | ||
// fmt.Println("second", second, city1, city2, string(value)) | ||
// console.log("second",ret,second, city1, city2) | ||
if (city1 >= 0 && city2 >= 0 && city1 < city2 && second < city1) { | ||
@@ -208,3 +206,3 @@ city = ret.cArea.slice(second, city1 + 1); | ||
} | ||
const ip = (ip6 >> N64) & FF; | ||
const ip = (ip6 >> 64n) & 0xffffffffffffffffn; | ||
debug("ip", ip); | ||
@@ -211,0 +209,0 @@ // IPv4映射地址 |
{ | ||
"name": "ip2region", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "ip/ipv6 to geo database, IP(支持IPv6)地址到区域运营商", | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"dev": "export NODE_ENV=dev && jest --verbose --watch", | ||
"test": "npm run compile && jest --coverage", | ||
"test": "jest --coverage", | ||
"tag": "git tag v`node -p 'require(\"./package\").version'`", | ||
@@ -45,3 +45,3 @@ "format": "prettier --write \"src/**/*.ts\"", | ||
"compile": "npm run clean && tsc", | ||
"prepublishOnly": "npm run format && npm run test && coveralls < coverage/lcov.info && npm test", | ||
"prepublishOnly": "npm run format && npm run compile && npm test && coveralls < coverage/lcov.info", | ||
"postpublish": "npm run tag && git push && git push --tags" | ||
@@ -48,0 +48,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10884700
681