CB-12697 Updated checked-in node_modules

This commit is contained in:
Steve Gill
2017-04-24 21:56:28 -07:00
committed by filmaj
parent af31c83ec1
commit 5a7590397d
12 changed files with 101 additions and 52 deletions

View File

@@ -118,7 +118,7 @@ var bigInt = (function (undefined) {
}
BigInteger.prototype.add = function (v) {
var value, n = parseValue(v);
var n = parseValue(v);
if (this.sign !== n.sign) {
return this.subtract(n.negate());
}
@@ -177,7 +177,7 @@ var bigInt = (function (undefined) {
}
function subtractAny(a, b, sign) {
var value, isSmall;
var value;
if (compareAbs(a, b) >= 0) {
value = subtract(a,b);
} else {
@@ -326,7 +326,7 @@ var bigInt = (function (undefined) {
}
BigInteger.prototype.multiply = function (v) {
var value, n = parseValue(v),
var n = parseValue(v),
a = this.value, b = n.value,
sign = this.sign !== n.sign,
abs;
@@ -826,23 +826,24 @@ var bigInt = (function (undefined) {
BigInteger.prototype.modInv = function (n) {
var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;
while (!newR.equals(bigInt.zero)) {
q = r.divide(newR);
lastT = t;
lastR = r;
t = newT;
r = newR;
newT = lastT.subtract(q.multiply(newT));
newR = lastR.subtract(q.multiply(newR));
q = r.divide(newR);
lastT = t;
lastR = r;
t = newT;
r = newR;
newT = lastT.subtract(q.multiply(newT));
newR = lastR.subtract(q.multiply(newR));
}
if (!r.equals(1)) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
if (t.compare(0) === -1) {
t = t.add(n);
t = t.add(n);
}
if (this.isNegative()) {
return t.negate();
}
return t;
}
};
SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
BigInteger.prototype.next = function () {
@@ -1036,8 +1037,7 @@ var bigInt = (function (undefined) {
return low.add(typeof result === "number" ? new SmallInteger(result) : new BigInteger(result, false));
}
var parseBase = function (text, base) {
var val = Integer[0], pow = Integer[1],
length = text.length;
var length = text.length;
if (2 <= base && base <= 36) {
if (length <= LOG_MAX_INT / Math.log(base)) {
return new SmallInteger(parseInt(text, base));
@@ -1059,13 +1059,17 @@ var bigInt = (function (undefined) {
}
else throw new Error(c + " is not a valid character");
}
digits.reverse();
for (i = 0; i < digits.length; i++) {
return parseBaseFromArray(digits, base, isNegative);
};
function parseBaseFromArray(digits, base, isNegative) {
var val = Integer[0], pow = Integer[1], i;
for (i = digits.length - 1; i >= 0; i--) {
val = val.add(digits[i].times(pow));
pow = pow.times(base);
}
return isNegative ? val.negate() : val;
};
}
function stringify(digit) {
var v = digit.value;
@@ -1209,6 +1213,11 @@ var bigInt = (function (undefined) {
Integer.lcm = lcm;
Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger; };
Integer.randBetween = randBetween;
Integer.fromArray = function (digits, base, isNegative) {
return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);
};
return Integer;
})();
@@ -1216,3 +1225,10 @@ var bigInt = (function (undefined) {
if (typeof module !== "undefined" && module.hasOwnProperty("exports")) {
module.exports = bigInt;
}
//amd check
if ( typeof define === "function" && define.amd ) {
define( "big-integer", [], function() {
return bigInt;
});
}

File diff suppressed because one or more lines are too long

7
node_modules/big-integer/README.md generated vendored
View File

@@ -421,6 +421,13 @@ Performs the bitwise XOR operation. The operands are treated as if they were rep
### Static Methods
#### `fromArray(digits, base = 10, isNegative?)`
Constructs a bigInt from an array of digits in base `base`. The optional `isNegative` flag will make the number negative.
- `bigInt.fromArray([1, 2, 3, 4, 5], 10)` => `12345`
- `bigInt.fromArray([1, 0, 0], 2, true)` => `-4`
#### `gcd(a, b)`
Finds the greatest common denominator of `a` and `b`.

View File

@@ -14,13 +14,13 @@
]
],
"_from": "big-integer@>=1.6.7 <2.0.0",
"_id": "big-integer@1.6.19",
"_id": "big-integer@1.6.22",
"_inCache": true,
"_location": "/big-integer",
"_nodeVersion": "6.9.4",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/big-integer-1.6.19.tgz_1491096256363_0.04815615131519735"
"tmp": "tmp/big-integer-1.6.22.tgz_1493091323169_0.5048394540790468"
},
"_npmUser": {
"name": "peterolson",
@@ -40,8 +40,8 @@
"_requiredBy": [
"/bplist-parser"
],
"_resolved": "http://registry.npmjs.org/big-integer/-/big-integer-1.6.19.tgz",
"_shasum": "4a5e915e3188c8708f254b356196f28542acc1e0",
"_resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.22.tgz",
"_shasum": "487c95fce886022ea48ff5f19e388932df46dd2e",
"_shrinkwrap": null,
"_spec": "big-integer@^1.6.7",
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/bplist-parser",
@@ -63,17 +63,18 @@
"karma": "^0.13.3",
"karma-coverage": "^0.4.2",
"karma-jasmine": "^0.3.6",
"karma-phantomjs-launcher": "~0.1"
"karma-phantomjs-launcher": "~0.1",
"uglifyjs": "^2.4.10"
},
"directories": {},
"dist": {
"shasum": "4a5e915e3188c8708f254b356196f28542acc1e0",
"tarball": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.19.tgz"
"shasum": "487c95fce886022ea48ff5f19e388932df46dd2e",
"tarball": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.22.tgz"
},
"engines": {
"node": ">=0.6"
},
"gitHead": "f0f751478d6623a84a5ed9618d94937829bbd015",
"gitHead": "40483b881b4380931e5af6f2f8a161b6caa71690",
"homepage": "https://github.com/peterolson/BigInteger.js#readme",
"keywords": [
"math",
@@ -102,7 +103,8 @@
"url": "git+ssh://git@github.com/peterolson/BigInteger.js.git"
},
"scripts": {
"minify": "uglifyjs BigInteger.js -o BigInteger.min.js",
"test": "karma start my.conf.js"
},
"version": "1.6.19"
"version": "1.6.22"
}