1.0.10 • Published 2 years ago

ip-address-validator v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

ip-address-validator

Validate the IP address and check its version

Install

npm install ip-address-validator

Usage

import {isIPAddress, isIPV6Address, isIPV4Address, ipVersion} from 'ip-address-validator';

isIPAddress('192.168.0.108');
//=> true

isIPAddress('a.b.c.d');
//=> false

isIPV4Address('10.10.8.4');
//=> true

isIPV6Address('1:2:3:4:5:6:7:8');
//=> true

isIPV6Address('::0');
//=> true

ipVersion('1:2:3:4:5:6:7:8');
//=> 6

ipVersion('10.10.8.4');
//=> 4

ipVersion('a.b.c.d');
//=> "Please enter valid IP address"

API

isIPAddress(string)

Check if the string is valid IP address.

isIPV6Address(string)

Check if the string is valid IPv6 address.

isIPV4Address(string)

Check if the string is valid IPv4 address.

ipVersion(string)

Returns 6 if the string is IPv6, Returns 4 if the string is IPv4, Returns undefined if the string is neither IPV4 nor IPV6.

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago