Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cidr-tools

Package Overview
Dependencies
Maintainers
1
Versions
92
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 4.0.0 to 4.1.0

2

index.d.ts

@@ -16,3 +16,3 @@ type IPv4Address = string;

normalize(cidr: Network): Network;
contains(networkA: Network, networkB: Network): boolean;
contains(networksA: Networks, networksB: Networks): boolean;
}

@@ -19,0 +19,0 @@

@@ -378,11 +378,25 @@ "use strict";

module.exports.contains = (a, b) => {
const aParsed = parse(a);
const bParsed = parse(b);
const aNets = uniq(Array.isArray(a) ? a : [a]);
const bNets = uniq(Array.isArray(b) ? b : [b]);
// version mismatch
if (aParsed.address.v4 !== bParsed.address.v4) {
return false;
const numExpected = bNets.length;
let numFound = 0;
for (const a of aNets) {
const aParsed = parse(a);
for (const b of bNets) {
const bParsed = parse(b);
// version mismatch
if (aParsed.address.v4 !== bParsed.address.v4) {
continue;
}
if (contains(aParsed, bParsed)) {
numFound++;
continue;
}
}
}
return contains(aParsed, bParsed);
return numFound === numExpected;
};
{
"name": "cidr-tools",
"version": "4.0.0",
"version": "4.1.0",
"author": "silverwind <me@silverwind.io>",

@@ -5,0 +5,0 @@ "description": "Tools to work with IPv4 and IPv6 CIDR network lists",

@@ -55,6 +55,6 @@ # cidr-tools

- `networkA` *String*: A CIDR or IP address.
- `networkB` *String*: A CIDR or IP address.
- `networksA` *String* or *Array*: One or more CIDR or IP address.
- `networksB` *String* or *Array*: One or more CIDR or IP address.
Returns a boolean that indicates whether `networksA` fully contains `networksB`.
Returns a boolean that indicates whether `networksA` fully contain all `networksB`.

@@ -61,0 +61,0 @@ ### cidrTools.normalize(network)

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