2020-12-25 10:18:01 -05:00
|
|
|
---
|
|
|
|
name: IP
|
|
|
|
parameters:
|
|
|
|
- ip
|
|
|
|
---
|
|
|
|
|
|
|
|
Converts an IPv4 address from string to an integer. This allows performing mathematical operations with the IP address.
|
|
|
|
|
|
|
|
This does not accept IPv6 addresses. (PRs gladly accepted.)
|
|
|
|
|
2022-03-04 13:49:03 +01:00
|
|
|
{% capture example %}
|
2022-02-17 18:22:31 +01:00
|
|
|
```js
|
2020-12-25 10:18:01 -05:00
|
|
|
var addrA = IP('1.2.3.4')
|
|
|
|
var addrB = addrA + 1
|
|
|
|
// addrB = 1.2.3.5
|
2022-02-17 18:22:31 +01:00
|
|
|
```
|
2022-03-04 13:49:03 +01:00
|
|
|
{% endcapture %}
|
2020-12-25 10:18:01 -05:00
|
|
|
|
2022-03-04 13:49:03 +01:00
|
|
|
{% include example.html content=example %}
|