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

is-ip

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-ip - npm Package Compare versions

Comparing version 5.0.0 to 5.0.1

26

index.js

@@ -12,15 +12,33 @@ import ipRegex from 'ip-regex';

export function isIP(string) {
return isMatch(ipRegex({exact: true}), string.slice(0, maxIPv6Length), options);
if (string.length > maxIPv6Length) {
return false;
}
return isMatch(ipRegex({exact: true}), string, options);
}
export function isIPv6(string) {
return isMatch(ipRegex.v6({exact: true}), string.slice(0, maxIPv6Length), options);
if (string.length > maxIPv6Length) {
return false;
}
return isMatch(ipRegex.v6({exact: true}), string, options);
}
export function isIPv4(string) {
return isMatch(ipRegex.v4({exact: true}), string.slice(0, maxIPv4Length), options);
if (string.length > maxIPv4Length) {
return false;
}
return isMatch(ipRegex.v4({exact: true}), string, options);
}
export function ipVersion(string) {
return isIP(string) ? (isIPv6(string) ? 6 : 4) : undefined;
if (isIPv6(string)) {
return 6;
}
if (isIPv4(string)) {
return 4;
}
}

4

package.json
{
"name": "is-ip",
"version": "5.0.0",
"version": "5.0.1",
"description": "Check if a string is an IP address",

@@ -53,4 +53,4 @@ "license": "MIT",

"tsd": "^0.22.0",
"xo": "^0.51.0"
"xo": "^0.54.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