1.0.17 • Published 6 years ago

np-ip v1.0.17

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

np-ip

Check losts of functions of ip

Install

$ npm install np-ip

Usage

const ipAddr = require('np-ip');

ipAddr.binary(10);
//=> 00000000000000000000000000001010

ipAddr.isValidIP('127.0.0.1');
//=> true

ipAddr.isPrivateIP('192.168.1.134');
//=> true

ipAddr.isPublicIP('192.168.1.134');
//=> false

ipAddr.toLong('127.0.0.1');
//=> 2130706433

ipAddr.fromLong(2130706433);
//=> 127.0.0.1

ipAddr.checkIpType('192.168.1.134');
//=>{ isValidIP: true, type: 'C' }

ipAddr.isCidr('192.168.1.134',32);
//=> true

ipAddr.subnet('192.168.1.134',26);
//=>{ isValidIP: true,
//   isValidMask: true,
//   contains: [Function],
//   subnet:
//    { internetAddr: '192.168.1.128',
//      broadcastAddr: '192.168.1.191',
//      firstAddr: '192.168.1.129',
//      lastAddr: '192.168.1.190',
//      subnetMask: '255.255.255.192',
//      hostNum: 62,
//      length: 64
//     }

ipAddr.subnet('192.168.1.134',26).contains('192.168.1.190');
//=> true

ipAddr.checkRange('192.168.1.134',26,'192.168.1.190');
//=>{ isValidIP: true, isValidMask: true, isInRange: true }

//Welcome to revise together!
1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago