Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions doc/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -1976,12 +1976,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 or an IPv4 address mapped to IPv6.
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
Expand Down Expand Up @@ -2016,10 +2017,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 or an IPv4 address mapped to IPv6.
Otherwise, returns `false`.

```js
net.isIPv6('::1'); // returns true
net.isIPv6('::ffff:127.0.0.1'); // returns true
net.isIPv6('fhqwhgads'); // returns false
```

Expand Down