New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cidr-tools

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cidr-tools - npm Package Compare versions

Comparing version 5.0.8 to 5.0.9

12

index.js
import IPCIDR from "ip-cidr";
import ipRegex from "ip-regex";
import isCidr from "is-cidr";
import ipv6Normalize from "ipv6-normalize";
import naturalCompare from "string-natural-compare";
import {stringifyIp} from "ip-bigint";
import {parseIp, stringifyIp} from "ip-bigint";
import {BigInteger} from "jsbn";

@@ -15,2 +14,3 @@

const bigint = numberstring => new BigInteger(numberstring);
const normalizeIp = str => stringifyIp(parseIp(str));
const uniq = arr => [...new Set(arr)];

@@ -35,3 +35,3 @@

let start = (new IPCIDR(cidr)).start();
if (cidrVersion === 6) start = ipv6Normalize(start).toString();
if (cidrVersion === 6) start = normalizeIp(start);
if (start) {

@@ -44,6 +44,6 @@ return `${start}${cidr.match(/\/.+/)}`.toLowerCase();

const parsed = parse(cidr);
if (parsed && parsed.address && parsed.address.v4) {
if (parsed?.address?.v4) {
return cidr;
} else if (parsed && parsed.address && parsed.address.v4 === false) {
return ipv6Normalize(cidr);
} else if (parsed?.address?.v4 === false) {
return normalizeIp(cidr);
}

@@ -50,0 +50,0 @@

{
"name": "cidr-tools",
"version": "5.0.8",
"version": "5.0.9",
"author": "silverwind <me@silverwind.io>",

@@ -35,3 +35,2 @@ "description": "Tools to work with IPv4 and IPv6 CIDR network lists",

"ip-regex": "5.0.0",
"ipv6-normalize": "1.0.1",
"is-cidr": "5.0.2",

@@ -45,5 +44,5 @@ "jsbn": "^1.1.0",

"jest": "29.0.3",
"updates": "13.1.5",
"versions": "9.3.0"
"updates": "13.1.7",
"versions": "9.3.2"
}
}

@@ -21,3 +21,3 @@ # cidr-tools

contains(["1.0.0.0/24", "2.0.0.0/24"], "1.0.0.1") //=> true
normalize('0:0:0:0:0:0:0:0/0') //=> '::/0'
normalize('::ffff/64') //=> '::/64'
```

@@ -24,0 +24,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc