Comparing version 1.1.0 to 1.1.1
@@ -7,3 +7,3 @@ 'use strict'; | ||
ip.toBuffer = function toBuffer(ip, buff, offset) { | ||
ip.toBuffer = function(ip, buff, offset) { | ||
offset = ~~offset; | ||
@@ -64,3 +64,3 @@ | ||
ip.toString = function toString(buff, offset, length) { | ||
ip.toString = function(buff, offset, length) { | ||
offset = ~~offset; | ||
@@ -93,7 +93,7 @@ length = length || (buff.length - offset); | ||
ip.isV4Format = function isV4Format(ip) { | ||
ip.isV4Format = function(ip) { | ||
return ipv4Regex.test(ip); | ||
}; | ||
ip.isV6Format = function isV6Format(ip) { | ||
ip.isV6Format = function(ip) { | ||
return ipv6Regex.test(ip); | ||
@@ -105,3 +105,3 @@ }; | ||
ip.fromPrefixLen = function fromPrefixLen(prefixlen, family) { | ||
ip.fromPrefixLen = function(prefixlen, family) { | ||
if (prefixlen > 32) { | ||
@@ -132,3 +132,3 @@ family = 'ipv6'; | ||
ip.mask = function mask(addr, mask) { | ||
ip.mask = function(addr, mask) { | ||
addr = ip.toBuffer(addr); | ||
@@ -167,3 +167,3 @@ mask = ip.toBuffer(mask); | ||
ip.cidr = function cidr(cidrString) { | ||
ip.cidr = function(cidrString) { | ||
var cidrParts = cidrString.split('/'); | ||
@@ -180,3 +180,3 @@ | ||
ip.subnet = function subnet(addr, mask) { | ||
ip.subnet = function(addr, mask) { | ||
var networkAddress = ip.toLong(ip.mask(addr, mask)); | ||
@@ -222,3 +222,3 @@ | ||
ip.cidrSubnet = function cidrSubnet(cidrString) { | ||
ip.cidrSubnet = function(cidrString) { | ||
var cidrParts = cidrString.split('/'); | ||
@@ -235,3 +235,3 @@ | ||
ip.not = function not(addr) { | ||
ip.not = function(addr) { | ||
var buff = ip.toBuffer(addr); | ||
@@ -244,3 +244,3 @@ for (var i = 0; i < buff.length; i++) { | ||
ip.or = function or(a, b) { | ||
ip.or = function(a, b) { | ||
a = ip.toBuffer(a); | ||
@@ -274,3 +274,3 @@ b = ip.toBuffer(b); | ||
ip.isEqual = function isEqual(a, b) { | ||
ip.isEqual = function(a, b) { | ||
a = ip.toBuffer(a); | ||
@@ -309,3 +309,3 @@ b = ip.toBuffer(b); | ||
ip.isPrivate = function isPrivate(addr) { | ||
ip.isPrivate = function(addr) { | ||
return /^(::f{4}:)?10\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/ | ||
@@ -324,7 +324,7 @@ .test(addr) || | ||
ip.isPublic = function isPublic(addr) { | ||
ip.isPublic = function(addr) { | ||
return !ip.isPrivate(addr); | ||
}; | ||
ip.isLoopback = function isLoopback(addr) { | ||
ip.isLoopback = function(addr) { | ||
return /^(::f{4}:)?127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/ | ||
@@ -337,3 +337,3 @@ .test(addr) || | ||
ip.loopback = function loopback(family) { | ||
ip.loopback = function(family) { | ||
// | ||
@@ -366,3 +366,3 @@ // Default to `ipv4` | ||
// | ||
ip.address = function address(name, family) { | ||
ip.address = function(name, family) { | ||
var interfaces = os.networkInterfaces(); | ||
@@ -413,3 +413,3 @@ var all; | ||
ip.toLong = function toInt(ip) { | ||
ip.toLong = function(ip) { | ||
var ipl = 0; | ||
@@ -423,3 +423,3 @@ ip.split('.').forEach(function(octet) { | ||
ip.fromLong = function fromInt(ipl) { | ||
ip.fromLong = function(ipl) { | ||
return ((ipl >>> 24) + '.' + | ||
@@ -426,0 +426,0 @@ (ipl >> 16 & 255) + '.' + |
{ | ||
"name": "ip", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"author": "Fedor Indutny <fedor@indutny.com>", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/indutny/node-ip", |
35048