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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4923
65
2
+ Addedsuper-regex@^0.2.0
+ Addedclone-regexp@3.0.0(transitive)
+ Addedconvert-hrtime@5.0.0(transitive)
+ Addedfunction-timeout@0.1.1(transitive)
+ Addedis-regexp@3.1.0(transitive)
+ Addedsuper-regex@0.2.0(transitive)
+ Addedtime-span@5.1.0(transitive)