diff --git a/package-lock.json b/package-lock.json index 74f4378..588c2e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "ip-regex": "^4.3.0", "ipaddr.js": "^2.0.1", - "is-ip": "^3.1.0", + "is-ip": "^4.0.0", "netmask": "^2.0.2" }, "devDependencies": { @@ -1065,14 +1065,28 @@ } }, "node_modules/is-ip": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-3.1.0.tgz", - "integrity": "sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-4.0.0.tgz", + "integrity": "sha512-4B4XA2HEIm/PY+OSpeMBXr8pGWBYbXuHgjMAqrwbLO3CPTCAd9ArEJzBUKGZtk9viY6+aSfadGnWyjY3ydYZkw==", "dependencies": { - "ip-regex": "^4.0.0" + "ip-regex": "^5.0.0" }, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-ip/node_modules/ip-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-5.0.0.tgz", + "integrity": "sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw==", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/is-number": { @@ -2785,11 +2799,18 @@ } }, "is-ip": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-3.1.0.tgz", - "integrity": "sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-ip/-/is-ip-4.0.0.tgz", + "integrity": "sha512-4B4XA2HEIm/PY+OSpeMBXr8pGWBYbXuHgjMAqrwbLO3CPTCAd9ArEJzBUKGZtk9viY6+aSfadGnWyjY3ydYZkw==", "requires": { - "ip-regex": "^4.0.0" + "ip-regex": "^5.0.0" + }, + "dependencies": { + "ip-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-5.0.0.tgz", + "integrity": "sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw==" + } } }, "is-number": { diff --git a/package.json b/package.json index b2bbede..b33ef6a 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "dependencies": { "ip-regex": "^4.3.0", "ipaddr.js": "^2.0.1", - "is-ip": "^3.1.0", + "is-ip": "^4.0.0", "netmask": "^2.0.2" } } diff --git a/src/index.ts b/src/index.ts index 2a29061..bd99af0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import { Netmask } from 'netmask' import ip_regex from 'ip-regex' -import is_ip from 'is-ip' +import { isIP } from 'is-ip' import { isValid as is_valid, parse, IPv4 } from 'ipaddr.js' const PRIVATE_IP_RANGES = [ @@ -62,7 +62,7 @@ export default (ip: string) => { if (parsed.kind() === 'ipv4') return ipv4_check((parsed as IPv4).toNormalizedString()) else if (parsed.kind() === 'ipv6') return ipv6_check(ip) - } else if (is_ip(ip) && ip_regex.v6().test(ip)) return ipv6_check(ip) + } else if (isIP(ip) && ip_regex.v6().test(ip)) return ipv6_check(ip) return undefined } diff --git a/yarn.lock b/yarn.lock index 2635e6c..6c5105b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -554,11 +554,16 @@ "resolved" "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" "version" "2.0.4" -"ip-regex@^4.0.0", "ip-regex@^4.3.0": +"ip-regex@^4.3.0": "integrity" "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==" "resolved" "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz" "version" "4.3.0" +"ip-regex@^5.0.0": + "integrity" "sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw==" + "resolved" "https://registry.npmjs.org/ip-regex/-/ip-regex-5.0.0.tgz" + "version" "5.0.0" + "ipaddr.js@^2.0.1": "integrity" "sha512-1qTgH9NG+IIJ4yfKs2e6Pp1bZg8wbDbKHT21HrLIeYBTRLgMYKnMTPAuI3Lcs61nfx5h1xlXnbJtH1kX5/d/ng==" "resolved" "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.0.1.tgz" @@ -603,12 +608,12 @@ dependencies: "is-extglob" "^2.1.1" -"is-ip@^3.1.0": - "integrity" "sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==" - "resolved" "https://registry.npmjs.org/is-ip/-/is-ip-3.1.0.tgz" - "version" "3.1.0" +"is-ip@^4.0.0": + "integrity" "sha512-4B4XA2HEIm/PY+OSpeMBXr8pGWBYbXuHgjMAqrwbLO3CPTCAd9ArEJzBUKGZtk9viY6+aSfadGnWyjY3ydYZkw==" + "resolved" "https://registry.npmjs.org/is-ip/-/is-ip-4.0.0.tgz" + "version" "4.0.0" dependencies: - "ip-regex" "^4.0.0" + "ip-regex" "^5.0.0" "is-number@^7.0.0": "integrity" "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="