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 4.0.0 to 5.0.0

14

index.js
import ipRegex from 'ip-regex';
import {isMatch} from 'super-regex';
const maxIPv4Length = 15;
const maxIPv6Length = 45;
const options = {
timeout: 400,
};
export function isIP(string) {
return ipRegex({exact: true}).test(string);
return isMatch(ipRegex({exact: true}), string.slice(0, maxIPv6Length), options);
}
export function isIPv6(string) {
return ipRegex.v6({exact: true}).test(string);
return isMatch(ipRegex.v6({exact: true}), string.slice(0, maxIPv6Length), options);
}
export function isIPv4(string) {
return ipRegex.v4({exact: true}).test(string);
return isMatch(ipRegex.v4({exact: true}), string.slice(0, maxIPv4Length), options);
}

@@ -14,0 +22,0 @@

{
"name": "is-ip",
"version": "4.0.0",
"version": "5.0.0",
"description": "Check if a string is an IP address",

@@ -11,8 +11,9 @@ "license": "MIT",

"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"types": "./index.d.ts",
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
"node": ">=14.16"
},

@@ -47,9 +48,10 @@ "scripts": {

"dependencies": {
"ip-regex": "^5.0.0"
"ip-regex": "^5.0.0",
"super-regex": "^0.2.0"
},
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.19.1",
"xo": "^0.47.0"
"ava": "^4.3.1",
"tsd": "^0.22.0",
"xo": "^0.51.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