@exodus/currency
Advanced tools
Comparing version 5.0.1 to 5.0.2
{ | ||
"name": "@exodus/currency", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "Currency support.", | ||
@@ -16,3 +16,2 @@ "type": "module", | ||
"@exodus/bigint": "^3.0.0", | ||
"bn.js": "^5.2.1", | ||
"lodash": "^4.17.11", | ||
@@ -22,9 +21,7 @@ "minimalistic-assert": "^1.0.1" | ||
"devDependencies": { | ||
"jest": "^29.3.1" | ||
"bn.js": "^5.2.1" | ||
}, | ||
"scripts": { | ||
"test:native-bigint": "run -T jest --selectProjects native-bigint", | ||
"test:bn.js": "run -T jest --selectProjects bn.js", | ||
"test": "run -T jest", | ||
"lint": "eslint . --ignore-path ../../.gitignore", | ||
"test": "run -T exodus-test --jest '**/__tests__/**/?(*.)+(spec|test).(t|j)s?(x)'", | ||
"lint": "run -T eslint . --ignore-path ../../.gitignore", | ||
"lint:fix": "yarn lint --fix" | ||
@@ -39,3 +36,3 @@ }, | ||
}, | ||
"gitHead": "a37317af4caf9e14cf8c097c145736964ebfaf53" | ||
"gitHead": "f5906d21aa52794b881bac338655f838bc4f3e68" | ||
} |
@@ -1,5 +0,14 @@ | ||
import BN from 'bn.js' | ||
import deprecationWarning from './deprecation-warning.js' | ||
import BigIntWrapper from '@exodus/bigint' | ||
function isMaybeBN(num) { | ||
const BNwordSize = 26 // always have been | ||
return ( | ||
num !== null && | ||
typeof num === 'object' && | ||
num.constructor.wordSize === BNwordSize && | ||
Array.isArray(num.words) | ||
) | ||
} | ||
export function createNumber(num, power) { | ||
@@ -10,3 +19,3 @@ if (num.isBigIntWrapper?.()) { | ||
if (BN.isBN(num) && power > 0) { | ||
if (isMaybeBN(num) && power > 0) { | ||
// throwing error because this convo truncated zeros incorrectly. | ||
@@ -43,3 +52,3 @@ throw new Error( | ||
num = num.toLowerCase() | ||
} else if (BN.isBN(num)) { | ||
} else if (isMaybeBN(num)) { | ||
num = num.toString() | ||
@@ -46,0 +55,0 @@ } else if (typeof num === 'bigint') { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
44829
3
824
0
- Removedbn.js@^5.2.1
- Removedbn.js@5.2.1(transitive)