-
Notifications
You must be signed in to change notification settings - Fork 0
toInteger()
Evgheniy Kovaliov edited this page May 10, 2023
·
1 revision
Method that allows you convert ip address to integer id.
Ip address must be correct. (see validation)
Parameters:
-
ip: string— ip address to convert.
Return:
number
Invalide ip address!:
- entered argument is not a correct ip address.
ipv4.toInteger('123.123.123.123'); // 2071690107
ipv4.toInteger('0.0.0.0'); // 0
ipv4.toInteger('255.255.255.255'); // 4294967295
ipv4.toInteger('1.2.3.4'); // 16909060
ipv4.toInteger('0.0.0.1'); // 1
ipv4.toInteger('1.0.0.0'); // 16777216
ipv4.toInteger('100.200.100.200'); // 1690854600
ipv4.toInteger('10.255.255.256'); // Error: Invalide ip address!
ipv4.toInteger('10.0.0.one'); // Error: Invalide ip address!
ipv4.toInteger('127.0.0.0.10'); // Error: Invalide ip address!- Is used in other methods.
Author: Evgheniy Kovaliov <kovaliov.evgeniy11@gmail.com>
For ip version 4
For ip version 6