-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👽️ Patch big-integer to support hex string
- Loading branch information
1 parent
0b3ac46
commit 2ef42ec
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff --git a/node_modules/big-integer/BigInteger.js b/node_modules/big-integer/BigInteger.js | ||
index c4263d5..cae03c7 100644 | ||
--- a/node_modules/big-integer/BigInteger.js | ||
+++ b/node_modules/big-integer/BigInteger.js | ||
@@ -10,6 +10,10 @@ var bigInt = (function (undefined) { | ||
var supportsNativeBigInt = typeof BigInt === "function"; | ||
|
||
function Integer(v, radix, alphabet, caseSensitive) { | ||
+ if (v.toString().includes('0x')) { | ||
+ v = v.substring(2); | ||
+ radix = 16; | ||
+ } | ||
if (typeof v === "undefined") return Integer[0]; | ||
if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive); | ||
return parseValue(v); |