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 4.2.0 to 4.3.0

3

index.d.ts

@@ -7,3 +7,2 @@ type IPv4Address = string;

type Network = IPv4Address | IPv4CIDR | IPv6Address | IPv6CIDR;
type Networks = Network | Network[];

@@ -16,3 +15,3 @@

overlap(networksA: Networks, networksB: Networks): boolean;
normalize(cidr: Network): Network;
normalize(cidr: Networks): Networks;
contains(networksA: Networks, networksB: Networks): boolean;

@@ -19,0 +18,0 @@ }

@@ -22,3 +22,3 @@ "use strict";

module.exports.normalize = (cidr) => {
function doNormalize(cidr) {
const cidrVersion = isCidr(cidr);

@@ -40,2 +40,6 @@ if (cidrVersion === 4) {

throw new Error(`Invalid network: ${cidr}`);
}
module.exports.normalize = (cidr) => {
return Array.isArray(cidr) ? cidr.map(doNormalize) : doNormalize(cidr);
};

@@ -42,0 +46,0 @@

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

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

@@ -20,2 +20,3 @@ # cidr-tools

cidrTools.overlap('1.0.0.0/24', '1.0.0.128/25') //=> true
cidrTools.contains(["1.0.0.0/24", "2.0.0.0/24"], "1.0.0.1") //=> true
cidrTools.normalize('0:0:0:0:0:0:0:0/0') //=> '::/0'

@@ -54,3 +55,3 @@ ```

### cidrTools.contains(networkA, networkB)
### cidrTools.contains(networksA, networksB)

@@ -62,8 +63,8 @@ - `networksA` *String* or *Array*: One or more CIDR or IP address.

### cidrTools.normalize(network)
### cidrTools.normalize(networks)
- `network` *String*: A CIDR or IP address.
- `networks` *String* or *Array*: One or more CIDR or IP address.
Returns a string with a normalized representation of a IP or CIDR. Will not include a prefix on single IPs.
Returns a string or array (depending on input) with a normalized representation of IPs or CIDRs. Will not include a prefix on single IPs.
© [silverwind](https://github.com/silverwind), distributed under BSD licence.
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