From f122fa202fda2c7bf334f35ccf3e4d2af1122fb1 Mon Sep 17 00:00:00 2001 From: Jordi Baylina Date: Thu, 25 Oct 2018 09:42:49 +0200 Subject: [PATCH] Fix 0x parser in old versions of node --- cli.js | 0 src/bigint.js | 12 +++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) mode change 100644 => 100755 cli.js diff --git a/cli.js b/cli.js old mode 100644 new mode 100755 diff --git a/src/bigint.js b/src/bigint.js index 7d9e58f..75df0b4 100644 --- a/src/bigint.js +++ b/src/bigint.js @@ -206,7 +206,17 @@ if (typeof(BigInt) != "undefined") { } else { - wBigInt = bigInt; + var oldProto = bigInt.prototype; + wBigInt = function(a) { + if ((typeof a == "string") && (a.slice(0,2) == "0x")) { + return bigInt(a.slice(2), 16); + } else { + return bigInt(a); + } + }; + wBigInt.one = bigInt.one; + wBigInt.zero = bigInt.zero; + wBigInt.prototype = oldProto; // Affine wBigInt.genAffine = (q) => {