cidr-tools 11.0.4 → 11.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -177,7 +177,11 @@ function mapNets(nets) {
|
|
|
177
177
|
function doMerge(maps) {
|
|
178
178
|
let start = null;
|
|
179
179
|
let end = null;
|
|
180
|
-
const numbers = Object.keys(maps)
|
|
180
|
+
const numbers = Object.keys(maps).sort((a, b) => {
|
|
181
|
+
const aBig = BigInt(a);
|
|
182
|
+
const bBig = BigInt(b);
|
|
183
|
+
return aBig > bBig ? 1 : aBig < bBig ? -1 : 0;
|
|
184
|
+
});
|
|
181
185
|
let depth = 0;
|
|
182
186
|
const merged = [];
|
|
183
187
|
for (const [index2, number] of numbers.entries()) {
|
|
@@ -203,7 +207,7 @@ function doMerge(maps) {
|
|
|
203
207
|
return merged;
|
|
204
208
|
}
|
|
205
209
|
function mergeCidr(nets) {
|
|
206
|
-
const arr = uniq((Array.isArray(nets) ? nets : [nets]).
|
|
210
|
+
const arr = uniq((Array.isArray(nets) ? nets : [nets]).map(parseCidr));
|
|
207
211
|
const maps = mapNets(arr);
|
|
208
212
|
const merged = { 4: [], 6: [] };
|
|
209
213
|
for (const v of [4, 6]) {
|