Skip to content

isPrefixValid()

Evgheniy Kovaliov edited this page Dec 22, 2023 · 1 revision

isPrefixValid(prefix)

Description

Method that allows you to check the correctness of the ip prefix.
Correct ip prefix must be a number from 0 to 32.

Contract

Parameters:

  • prefix — value, that will be checked.

Return:

  • true/false
Usage
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.

MAIN PAGE

See all methods documentation:

For ip version 4

For ip version 6

Clone this wiki locally