Skip to content

Commit

Permalink
chore: migrate to is-ip 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Oct 28, 2022
1 parent d338fe5 commit 8ce9c5c
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 19 deletions.
41 changes: 31 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down Expand Up @@ -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
}
17 changes: 11 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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=="
Expand Down

0 comments on commit 8ce9c5c

Please sign in to comment.