Created
February 7, 2019 09:15
-
-
Save eviltik/b4dda95e7e946a2e42b56c5825bc6327 to your computer and use it in GitHub Desktop.
cidrClean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cidrClean = require('cidr-clean'); | |
let list = [ | |
'1.0.0.0/8', | |
'100.1.1.12/31', | |
'100.1.1.2/31', | |
'100.1.1.4/30', | |
'100.1.1.8/30', | |
'100.10.1.44/30', | |
'100.10.1.54/31', | |
'100.10.1.64/31', | |
..... | |
]; | |
let cleanlist = cidrClean(list); | |
for (let range of cleanlist) { | |
console.log(range); | |
} | |
// display | |
console.log('before', list.length); | |
console.log('after', cleanlist.length); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment