-
Notifications
You must be signed in to change notification settings - Fork 0
isPrefixValid()
Evgheniy Kovaliov edited this page Dec 22, 2023
·
1 revision
Method that allows you to check the correctness of the ip prefix.
Correct ip prefix must be a number from 0 to 32.
Parameters:
-
prefix— value, that will be checked.
Return:
-
true/false
ipv4.isPrefixValid(0); // true
ipv4.isPrefixValid(32); // true
ipv4.isPrefixValid(17); // true
ipv4.isPrefixValid(1); // true
ipv4.isPrefixValid(-1); // false
ipv4.isPrefixValid(33); // false
ipv4.isPrefixValid(64); // false
ipv4.isPrefixValid('12'); // false
ipv4.isPrefixValid([12]); // false- Is used in other methods.
Author: Evgheniy Kovaliov <kovaliov.evgeniy11@gmail.com>
For ip version 4
For ip version 6