Comparing version 2.1.1 to 2.1.2
16
index.js
@@ -43,3 +43,3 @@ "use strict"; | ||
if (options.type == "bigInteger") { | ||
return address.bigInteger(); | ||
return new BigInteger(address.bigInteger().toString()); | ||
} | ||
@@ -92,4 +92,4 @@ else if (options.type == "addressObject") { | ||
const list = []; | ||
const start = this.addressStart.bigInteger(); | ||
const end = this.addressEnd.bigInteger(); | ||
const start = this.formatIP(this.addressStart, { type: 'bigInteger' }); | ||
const end = this.formatIP(this.addressEnd, { type: 'bigInteger' }); | ||
const length = end.subtract(start).add(new BigInteger('1')); | ||
@@ -114,4 +114,4 @@ const info = this.getChunkInfo(length, options); | ||
const promise = []; | ||
const start = this.addressStart.bigInteger(); | ||
const end = this.addressEnd.bigInteger(); | ||
const start = this.formatIP(this.addressStart, { type: 'bigInteger' }); | ||
const end = this.formatIP(this.addressEnd, { type: 'bigInteger' }); | ||
const length = end.subtract(start).add(new BigInteger('1')); | ||
@@ -147,7 +147,7 @@ const info = this.getChunkInfo(length, options); | ||
let maxLength; | ||
const addressBigInteger = this.address.bigInteger(); | ||
const addressBigInteger = this.formatIP(this.address, { type: 'bigInteger' }); | ||
function getBigInteger(val) { | ||
const getBigInteger = (val) => { | ||
if(typeof val == 'string' && val.match(/:|\./)) { | ||
return createAddress(val).bigInteger().subtract(addressBigInteger); | ||
return this.formatIP(createAddress(val), { type: 'bigInteger' }).subtract(addressBigInteger); | ||
} | ||
@@ -154,0 +154,0 @@ else if(typeof val != 'object') { |
{ | ||
"name": "ip-cidr", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Module for working with CIDR (v4, v6)", | ||
@@ -31,3 +31,3 @@ "main": "./index.js", | ||
"ip-address": "^6.3.0", | ||
"jsbn": "^0.1.0" | ||
"jsbn": "^1.1.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "devDependencies": { |
@@ -61,3 +61,3 @@ "use strict"; | ||
const cidr = new IPCIDR(validCIDR); | ||
assert.equal(JSON.stringify(cidr.address.bigInteger()), JSON.stringify(cidr.formatIP(cidr.address, { type: "bigInteger" }))); | ||
assert.equal(JSON.stringify(cidr.formatIP(cidr.address, { type: 'bigInteger' })), JSON.stringify(cidr.formatIP(cidr.address, { type: "bigInteger" }))); | ||
}); | ||
@@ -64,0 +64,0 @@ |
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
268552
8762
- Removedjsbn@0.1.1(transitive)
Updatedjsbn@^1.1.0