Negligent Pachinko Machine

npm

Need private packages and team management tools?Check out npm Orgs. »

inet_ipv4

1.0.1 • Public • Published

inet_ipv4

====

Install with:

$ npm install inet_ipv4

Usage:

var inet_ipv4 = require('inet_ipv4');
 
inet_ipv4.aton('192.168.0.1')
// 3232235521
 
inet_ipv4.ntoa(3232235521)
// '192.168.0.1'
 
inet_ipv4.normalize('255.255.0x0001')
inet_ipv4.normalize('0xff000001')
inet_ipv4.normalize('037700000001')
// '255.255.0.1'
 
inet_ipv4.isValid('255.255.255.255')
// true

API Documentation

aton(str) -> int

http://linux.die.net/man/3/inet_aton Returns null if the parameter is invalid.

ntoa(int) -> str

http://linux.die.net/man/3/inet_ntoa Returns null if the parameter is invalid.

normalize(str) -> str

Converts the ip given as a parameter to a 4 part string format. Returns null if the parameter is invalid.

isValid(str) -> bool

Uses a regex to check if the parameter is a 4 part ip representation.

Tests

$ npm test

install

npm i inet_ipv4

Downloadsweekly downloads

61

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability