ip-parse
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

ip-parse

convert ip into an array,support ipv4 and ipv6.

install

npm install ip-parse

example

ipParse.parseIp('127.0.0.1') // output: ['127','0','0','1']
ipParse.parseIp('110.120.119.255') // output: ['110','120','119','255']
ipParse.parseIp('256.120.119.255') // output: []  // because ipv4 every num must lte 255
ipParse.parseIp('::') // output: ['0','0','0','0','0','0','0','0']
ipParse.parseIp('::1') // output: ['0','0','0','0','0','0','0','1']
ipParse.parseIp('1:2:3::') // output: ['1','2','3','0','0','0','0','0']
ipParse.parseIp('1:2:3:4:5:6:7:ffff') // output: ['1','2','3','4','5','6','7','ffff']
ipParse.parseIp('1::2::3') // output: []  // because ipv6 only one ::

Package Sidebar

Install

npm i ip-parse

Weekly Downloads

24

Version

1.0.5

License

MIT

Unpacked Size

7.06 kB

Total Files

7

Last publish

Collaborators

  • zy445566