cidr-tools
Advanced tools
Comparing version 2.2.6 to 2.2.7
17
index.js
@@ -145,2 +145,11 @@ "use strict"; | ||
function subparts(part) { | ||
// special case for when part is length 1 | ||
if (part.end.subtract(part.start).compareTo(one) === 0) { | ||
if (part.end.remainder(two).equals(zero)) { | ||
return [{start: part.start, end: part.start}, {start: part.end, end: part.end}]; | ||
} else { | ||
return [{start: part.start, end: part.end}]; | ||
} | ||
} | ||
const size = diff(part.end, part.start); | ||
@@ -158,7 +167,13 @@ let biggest = biggestPowerOfTwo(size); | ||
start = part.end.divide(biggest).multiply(biggest); | ||
// start is not matching on the size-defined boundary - 4-16, use 8-16 | ||
if (start.add(biggest).subtract(one).compareTo(part.end) > 0) { | ||
biggest = biggest.divide(two); | ||
// divide will floor to nearest integer | ||
start = part.end.divide(biggest).subtract(one).multiply(biggest); | ||
while (start.compareTo(part.start) < 0) { | ||
biggest = biggest.divide(two); | ||
start = part.end.divide(biggest).subtract(one).multiply(biggest); | ||
} | ||
end = start.add(biggest).subtract(one); | ||
@@ -165,0 +180,0 @@ } else { |
{ | ||
"name": "cidr-tools", | ||
"version": "2.2.6", | ||
"version": "2.2.7", | ||
"author": "silverwind <me@silverwind.io>", | ||
@@ -38,7 +38,7 @@ "description": "Tools to work with IPv4 and IPv6 CIDR network lists", | ||
"devDependencies": { | ||
"eslint": "^5.11.0", | ||
"eslint-config-silverwind": "^2.0.12", | ||
"updates": "^6.0.2", | ||
"eslint": "^5.12.1", | ||
"eslint-config-silverwind": "^2.0.14", | ||
"updates": "^6.2.1", | ||
"ver": "^3.0.1" | ||
} | ||
} |
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
13767
303