Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ethersproject/bignumber

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethersproject/bignumber - npm Package Compare versions

Comparing version 5.4.2 to 5.5.0

2

lib.esm/_version.d.ts

@@ -1,2 +0,2 @@

export declare const version = "bignumber/5.4.2";
export declare const version = "bignumber/5.5.0";
//# sourceMappingURL=_version.d.ts.map

@@ -1,2 +0,2 @@

export const version = "bignumber/5.4.2";
export const version = "bignumber/5.5.0";
//# sourceMappingURL=_version.js.map

@@ -213,3 +213,3 @@ "use strict";

if (anyValue) {
// Hexable interface (takes piority)
// Hexable interface (takes priority)
if (anyValue.toHexString) {

@@ -251,3 +251,3 @@ const hex = anyValue.toHexString();

value = value.substring(1);
// Cannot have mulitple negative signs (e.g. "--0x04")
// Cannot have multiple negative signs (e.g. "--0x04")
if (value[0] === "-") {

@@ -254,0 +254,0 @@ logger.throwArgumentError("invalid hex", "value", value);

@@ -69,3 +69,3 @@ "use strict";

const multiplier = getMultiplier(decimals);
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
logger.throwArgumentError("invalid decimal value", "value", value);

@@ -93,7 +93,7 @@ }

}
// Trim trialing zeros
// Trim trailing zeros
while (fraction[fraction.length - 1] === "0") {
fraction = fraction.substring(0, fraction.length - 1);
}
// Check the fraction doesn't exceed our decimals
// Check the fraction doesn't exceed our decimals size
if (fraction.length > multiplier.length - 1) {

@@ -100,0 +100,0 @@ throwFault("fractional component exceeds decimals", "underflow", "parseFixed");

@@ -1,2 +0,2 @@

export declare const version = "bignumber/5.4.2";
export declare const version = "bignumber/5.5.0";
//# sourceMappingURL=_version.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = void 0;
exports.version = "bignumber/5.4.2";
exports.version = "bignumber/5.5.0";
//# sourceMappingURL=_version.js.map

@@ -26,5 +26,5 @@ "use strict";

(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
bytes_1.isHexString(value) ||
(0, bytes_1.isHexString)(value) ||
(typeof (value) === "bigint") ||
bytes_1.isBytes(value));
(0, bytes_1.isBytes)(value));
}

@@ -217,7 +217,7 @@ exports.isBigNumberish = isBigNumberish;

}
if (bytes_1.isBytes(anyValue)) {
return BigNumber.from(bytes_1.hexlify(anyValue));
if ((0, bytes_1.isBytes)(anyValue)) {
return BigNumber.from((0, bytes_1.hexlify)(anyValue));
}
if (anyValue) {
// Hexable interface (takes piority)
// Hexable interface (takes priority)
if (anyValue.toHexString) {

@@ -237,3 +237,3 @@ var hex = anyValue.toHexString();

if (typeof (hex) === "string") {
if (bytes_1.isHexString(hex) || (hex[0] === "-" && bytes_1.isHexString(hex.substring(1)))) {
if ((0, bytes_1.isHexString)(hex) || (hex[0] === "-" && (0, bytes_1.isHexString)(hex.substring(1)))) {
return BigNumber.from(hex);

@@ -262,3 +262,3 @@ }

value = value.substring(1);
// Cannot have mulitple negative signs (e.g. "--0x04")
// Cannot have multiple negative signs (e.g. "--0x04")
if (value[0] === "-") {

@@ -265,0 +265,0 @@ logger.throwArgumentError("invalid hex", "value", value);

@@ -72,3 +72,3 @@ "use strict";

var multiplier = getMultiplier(decimals);
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
if (typeof (value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
logger.throwArgumentError("invalid decimal value", "value", value);

@@ -96,7 +96,7 @@ }

}
// Trim trialing zeros
// Trim trailing zeros
while (fraction[fraction.length - 1] === "0") {
fraction = fraction.substring(0, fraction.length - 1);
}
// Check the fraction doesn't exceed our decimals
// Check the fraction doesn't exceed our decimals size
if (fraction.length > multiplier.length - 1) {

@@ -291,3 +291,3 @@ throwFault("fractional component exceeds decimals", "underflow", "parseFixed");

var hex = bignumber_1.BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
return bytes_1.hexZeroPad(hex, width / 8);
return (0, bytes_1.hexZeroPad)(hex, width / 8);
};

@@ -300,3 +300,3 @@ FixedNumber.prototype.toUnsafeFloat = function () { return parseFloat(this.toString()); };

// If decimals looks more like a format, and there is no format, shift the parameters
if (format == null && decimals != null && !bignumber_1.isBigNumberish(decimals)) {
if (format == null && decimals != null && !(0, bignumber_1.isBigNumberish)(decimals)) {
format = decimals;

@@ -328,3 +328,3 @@ decimals = null;

hex = numeric.toHexString();
hex = bytes_1.hexZeroPad(hex, fixedFormat.width / 8);
hex = (0, bytes_1.hexZeroPad)(hex, fixedFormat.width / 8);
}

@@ -339,3 +339,3 @@ var decimal = formatFixed(numeric, fixedFormat.decimals);

var fixedFormat = FixedFormat.from(format);
if (bytes_1.arrayify(value).length > fixedFormat.width / 8) {
if ((0, bytes_1.arrayify)(value).length > fixedFormat.width / 8) {
throw new Error("overflow");

@@ -355,3 +355,3 @@ }

}
if (bytes_1.isBytes(value)) {
if ((0, bytes_1.isBytes)(value)) {
return FixedNumber.fromBytes(value, format);

@@ -358,0 +358,0 @@ }

{
"author": "Richard Moore <me@ricmoo.com>",
"dependencies": {
"@ethersproject/bytes": "^5.4.0",
"@ethersproject/logger": "^5.4.0",
"@ethersproject/bytes": "^5.5.0",
"@ethersproject/logger": "^5.5.0",
"bn.js": "^4.11.9"

@@ -20,3 +20,3 @@ },

],
"gitHead": "4166b2753d0d6b230a3a22b5a2b6c4e1906a7af7",
"gitHead": "73a46efea32c3f9a4833ed77896a216e3d3752a0",
"keywords": [

@@ -43,5 +43,5 @@ "Ethereum",

"sideEffects": false,
"tarballHash": "0x7bf3f4803f1cf34254178ed8f023a0bef9ffc4c2312ec9499a2521fdd2f403cb",
"tarballHash": "0xc96a25dc52eed1cbc00347b751e5beea569cdc12b2c2df276fc08a7f4d756f72",
"types": "./lib/index.d.ts",
"version": "5.4.2"
"version": "5.5.0"
}

@@ -1,1 +0,1 @@

export const version = "bignumber/5.4.2";
export const version = "bignumber/5.5.0";

@@ -267,3 +267,3 @@ "use strict";

// Hexable interface (takes piority)
// Hexable interface (takes priority)
if (anyValue.toHexString) {

@@ -313,3 +313,3 @@ const hex = anyValue.toHexString();

// Cannot have mulitple negative signs (e.g. "--0x04")
// Cannot have multiple negative signs (e.g. "--0x04")
if (value[0] === "-") { logger.throwArgumentError("invalid hex", "value", value); }

@@ -316,0 +316,0 @@

@@ -75,3 +75,3 @@ "use strict";

if (typeof(value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
if (typeof(value) !== "string" || !value.match(/^-?[0-9.]+$/)) {
logger.throwArgumentError("invalid decimal value", "value", value);

@@ -98,3 +98,3 @@ }

// Trim trialing zeros
// Trim trailing zeros
while (fraction[fraction.length - 1] === "0") {

@@ -104,3 +104,3 @@ fraction = fraction.substring(0, fraction.length - 1);

// Check the fraction doesn't exceed our decimals
// Check the fraction doesn't exceed our decimals size
if (fraction.length > multiplier.length - 1) {

@@ -107,0 +107,0 @@ throwFault("fractional component exceeds decimals", "underflow", "parseFixed");

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc