ip-address
Advanced tools
Comparing version 5.8.9 to 5.9.0
@@ -187,2 +187,14 @@ 'use strict'; | ||
/** | ||
* Helper function getting start address. | ||
* @memberof Address4 | ||
* @instance | ||
* @returns {BigInteger} | ||
*/ | ||
Address4.prototype._startAddress = function () { | ||
return new BigInteger( | ||
this.mask() + repeat(0, constants.BITS - this.subnetMask), 2 | ||
); | ||
}; | ||
/** | ||
* The first address in the range given by this address' subnet. | ||
@@ -195,9 +207,30 @@ * Often referred to as the Network Address. | ||
Address4.prototype.startAddress = function () { | ||
var startAddress = new BigInteger(this.mask() + | ||
repeat(0, constants.BITS - this.subnetMask), 2); | ||
return Address4.fromBigInteger(this._startAddress()); | ||
}; | ||
return Address4.fromBigInteger(startAddress); | ||
/** | ||
* The first host address in the range given by this address's subnet ie | ||
* the first address after the Network Address | ||
* @memberof Address4 | ||
* @instance | ||
* @returns {Address4} | ||
*/ | ||
Address4.prototype.startAddressExclusive = function () { | ||
var adjust = new BigInteger('1'); | ||
return Address4.fromBigInteger(this._startAddress().add(adjust)); | ||
}; | ||
/** | ||
* Helper function getting end address. | ||
* @memberof Address4 | ||
* @instance | ||
* @returns {BigInteger} | ||
*/ | ||
Address4.prototype._endAddress = function () { | ||
return new BigInteger( | ||
this.mask() + repeat(1, constants.BITS - this.subnetMask), 2 | ||
); | ||
}; | ||
/** | ||
* The last address in the range given by this address' subnet | ||
@@ -210,6 +243,15 @@ * Often referred to as the Broadcast | ||
Address4.prototype.endAddress = function () { | ||
var endAddress = new BigInteger(this.mask() + | ||
repeat(1, constants.BITS - this.subnetMask), 2); | ||
return Address4.fromBigInteger(this._endAddress()); | ||
}; | ||
return Address4.fromBigInteger(endAddress); | ||
/** | ||
* The last host address in the range given by this address's subnet ie | ||
* the last address prior to the Broadcast Address | ||
* @memberof Address4 | ||
* @instance | ||
* @returns {Address4} | ||
*/ | ||
Address4.prototype.endAddressExclusive = function () { | ||
var adjust = new BigInteger('1'); | ||
return Address4.fromBigInteger(this._endAddress().subtract(adjust)); | ||
}; | ||
@@ -216,0 +258,0 @@ |
@@ -316,3 +316,16 @@ 'use strict'; | ||
/** | ||
* Helper function getting start address. | ||
* @memberof Address6 | ||
* @instance | ||
* @returns {BigInteger} | ||
*/ | ||
Address6.prototype._startAddress = function () { | ||
return new BigInteger( | ||
this.mask() + repeat(0, constants6.BITS - this.subnetMask), 2 | ||
); | ||
}; | ||
/** | ||
* The first address in the range given by this address' subnet | ||
* Often referred to as the Network Address. | ||
* @memberof Address6 | ||
@@ -323,10 +336,32 @@ * @instance | ||
Address6.prototype.startAddress = function () { | ||
var startAddress = new BigInteger(this.mask() + | ||
repeat(0, constants6.BITS - this.subnetMask), 2); | ||
return Address6.fromBigInteger(this._startAddress()); | ||
}; | ||
return Address6.fromBigInteger(startAddress); | ||
/** | ||
* The first host address in the range given by this address's subnet ie | ||
* the first address after the Network Address | ||
* @memberof Address6 | ||
* @instance | ||
* @returns {Address6} | ||
*/ | ||
Address6.prototype.startAddressExclusive = function () { | ||
var adjust = new BigInteger('1'); | ||
return Address6.fromBigInteger(this._startAddress().add(adjust)); | ||
}; | ||
/** | ||
* Helper function getting end address. | ||
* @memberof Address6 | ||
* @instance | ||
* @returns {BigInteger} | ||
*/ | ||
Address6.prototype._endAddress = function () { | ||
return new BigInteger( | ||
this.mask() + repeat(1, constants6.BITS - this.subnetMask), 2 | ||
); | ||
}; | ||
/** | ||
* The last address in the range given by this address' subnet | ||
* Often referred to as the Broadcast | ||
* @memberof Address6 | ||
@@ -337,6 +372,15 @@ * @instance | ||
Address6.prototype.endAddress = function () { | ||
var endAddress = new BigInteger(this.mask() + | ||
repeat(1, constants6.BITS - this.subnetMask), 2); | ||
return Address6.fromBigInteger(this._endAddress()); | ||
}; | ||
return Address6.fromBigInteger(endAddress); | ||
/** | ||
* The last host address in the range given by this address's subnet ie | ||
* the last address prior to the Broadcast Address | ||
* @memberof Address6 | ||
* @instance | ||
* @returns {Address6} | ||
*/ | ||
Address6.prototype.endAddressExclusive = function () { | ||
var adjust = new BigInteger('1'); | ||
return Address6.fromBigInteger(this._endAddress().subtract(adjust)); | ||
}; | ||
@@ -343,0 +387,0 @@ |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "5.8.9", | ||
"version": "5.9.0", | ||
"author": "Beau Gunderson <beau@beaugunderson.com> (https://beaugunderson.com/)", | ||
@@ -31,9 +31,9 @@ "license": "MIT", | ||
"lodash.max": "^4.0.1", | ||
"lodash.merge": "^4.6.0", | ||
"lodash.merge": "^4.6.1", | ||
"lodash.padstart": "^4.6.1", | ||
"lodash.repeat": "^4.1.0", | ||
"sprintf-js": "1.1.0" | ||
"sprintf-js": "1.1.1" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^14.5.0", | ||
"browserify": "^16.2.0", | ||
"chai": "^4.1.2", | ||
@@ -43,5 +43,5 @@ "codecov.io": "^0.1.6", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^3.5.3", | ||
"mochify": "^3.3.0" | ||
"mocha": "^5.1.1", | ||
"mochify": "^5.6.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
303620
9752
+ Addedsprintf-js@1.1.1(transitive)
- Removedsprintf-js@1.1.0(transitive)
Updatedlodash.merge@^4.6.1
Updatedsprintf-js@1.1.1