mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
doc: clarify that ipv4 mapped to ipv6 are classified as ipv6
Signed-off-by: Vedant Kulkarni <gamemaker0042@gmail.com> PR-URL: https://github.com/nodejs/node/pull/62117 Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
1 parent
6a248acefe
commit
7809f11249
1 file changed
+7
-4
+7
-4
@@ -2375,12 +2375,13 @@ added: v0.3.0
|
||||
* `input` {string}
|
||||
* Returns: {integer}
|
||||
|
||||
Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4
|
||||
address in [dot-decimal notation][] with no leading zeroes. Otherwise, returns
|
||||
`0`.
|
||||
Returns `6` if `input` is an IPv6 address, including an IPv4-mapped IPv6 address.
|
||||
Returns `4` if `input` is an IPv4 address in [dot-decimal notation][] with no
|
||||
leading zeroes. Otherwise, returns `0`.
|
||||
|
||||
```js
|
||||
net.isIP('::1'); // returns 6
|
||||
net.isIP('::ffff:127.0.0.1'); // returns 6
|
||||
net.isIP('127.0.0.1'); // returns 4
|
||||
net.isIP('127.000.000.001'); // returns 0
|
||||
net.isIP('127.0.0.1/24'); // returns 0
|
||||
@@ -2415,10 +2416,12 @@ added: v0.3.0
|
||||
* `input` {string}
|
||||
* Returns: {boolean}
|
||||
|
||||
Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`.
|
||||
Returns `true` if `input` is an IPv6 address, including an IPv4-mapped IPv6 address.
|
||||
Otherwise, returns `false`.
|
||||
|
||||
```js
|
||||
net.isIPv6('::1'); // returns true
|
||||
net.isIPv6('::ffff:127.0.0.1'); // returns true
|
||||
net.isIPv6('fhqwhgads'); // returns false
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user