Skip to content

isShort()

Evgheniy Kovaliov edited this page Jul 26, 2023 · 2 revisions

isShort(ip)

Description

Method that allows you to check if ipv6 address is a short format(compressed).
Ip address must be correct. (see validation)

Contract

Parameters:

  • ip: string — address, that will be checked.

Return:

  • true/false
Exceptions

Invalide ip address!:

  • entered argument is not a correct ipv6 address.
Usage
ipv6.isShort('::');                                      // true
ipv6.isShort('::aaaa');                                  // true
ipv6.isShort('7759:f8bf:2d23:7be9:25fb:adab:6b5:b7a9');  // true

ipv6.isShort('7759:f8bf:2d23:7be9:25fb:adab:b6b5:b7a9'); // false
ipv6.isShort('0000:0000:0000:0000:0000:0000:0000:0000'); // false
ipv6.isShort('FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF'); // false

ipv4.isPrivate('7759:f8bf:2d23:7be9:25fb:adab:b6b5:');   // Error: Invalide ip address!

MAIN PAGE

See all methods documentation:

For ip version 4

For ip version 6

Clone this wiki locally