ip-address
Advanced tools
Comparing version 5.8.3 to 5.8.4
@@ -208,2 +208,37 @@ 'use strict'; | ||
/** | ||
* Return an address from ip6.arpa form | ||
* @memberof Address6 | ||
* @static | ||
* @param {string} arpaFormAddress - an 'ip6.arpa' form address | ||
* @returns {Adress6} | ||
* @example | ||
* var address = Address6.fromArpa(e.f.f.f.3.c.2.6.f.f.f.e.6.6.8.e.1.0.6.7.9.4.e.c.0.0.0.0.1.0.0.2.ip6.arpa.) | ||
* address.correctForm(); // '2001:0:ce49:7601:e866:efff:62c3:fffe' | ||
*/ | ||
Address6.fromArpa = function (arpaFormAddress) { | ||
//remove ending ".ip6.arpa." or just "." | ||
var address = arpaFormAddress.replace(/(\.ip6\.arpa)?\.$/, ''); | ||
var semicolonAmount = 7; | ||
//correct ip6.arpa form with ending removed will be 63 characters | ||
if (address.length !== 63) { | ||
address = { | ||
error: "Not Valid 'ip6.arpa' form", | ||
address: null | ||
}; | ||
return address; | ||
} | ||
address = address.split('.').reverse(); | ||
for (var i = semicolonAmount; i > 0; i--) { | ||
var insertIndex = i * 4; | ||
address.splice(insertIndex, 0, ':'); | ||
} | ||
address = address.join(''); | ||
return new Address6(address); | ||
}; | ||
/* | ||
@@ -210,0 +245,0 @@ * A helper function to compact an array |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "5.8.3", | ||
"version": "5.8.4", | ||
"author": "Beau Gunderson <beau@beaugunderson.com> (https://beaugunderson.com/)", | ||
@@ -20,6 +20,2 @@ "license": "MIT", | ||
}, | ||
"bin": { | ||
"ipv6": "bin/ipv6.js", | ||
"ipv6grep": "bin/ipv6grep.js" | ||
}, | ||
"engines": { | ||
@@ -26,0 +22,0 @@ "node": ">= 0.10" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
141351
1479
0