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 6.1.0 to 6.2.0

13

index.js

@@ -25,17 +25,18 @@ import ipRegex from "ip-regex";

function doNormalize(cidr, {compress = true} = {}) {
function doNormalize(cidr, {compress = true, hexify = false} = {}) {
const {start, prefix, single, version} = parse(cidr);
if (!single) { // cidr
// set network address to first address
return `${normalizeIp(stringifyIp({number: start, version}), {compress})}/${prefix}`;
const ip = normalizeIp(stringifyIp({number: start, version}), {compress, hexify});
return `${ip}/${prefix}`;
} else { // single ip
return normalizeIp(cidr, {compress});
return normalizeIp(cidr, {compress, hexify});
}
}
export function normalize(cidr, {compress = true} = {}) {
export function normalize(cidr, {compress = true, hexify = false} = {}) {
if (Array.isArray(cidr)) {
return cidr.map(entry => normalize(entry, {compress}));
return cidr.map(entry => normalize(entry, {compress, hexify}));
} else {
return doNormalize(cidr, {compress});
return doNormalize(cidr, {compress, hexify});
}

@@ -42,0 +43,0 @@ }

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

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

"cidr-regex": "4.0.3",
"ip-bigint": "7.1.0",
"ip-bigint": "7.2.0",
"ip-regex": "5.0.0",

@@ -25,0 +25,0 @@ "string-natural-compare": "3.0.1"

@@ -71,3 +71,4 @@ # cidr-tools

- `compress`: Whether to compress the IP. For IPv6, this means the "best representation" all-lowercase shortest possible form. Default: `true`.
- `hexify`: Whether to convert IPv4-Mapped IPv6 addresses to hex. Default: `false`.
© [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