New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@exodus/currency

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@exodus/currency - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

17

lib/number-unit.js

@@ -22,2 +22,11 @@ "use strict";

const reportDifferentTypesDeprecated = (num, otherNum) => {
try {
console.warn('***************************************************************');
console.warn(`DEPRECATION WARNING: number-unit.add/sub on different NumberUnit types (${num}, ${otherNum}) is not correct and will be removed soon`);
console.warn('***************************************************************');
console.trace();
} catch (err) {}
};
class NumberUnit {

@@ -161,2 +170,4 @@ static create(num, unit) {

num = this._coerceToNumberUnit(num);
if (num.unitType !== this.unitType) reportDifferentTypesDeprecated(this, num);
if (num.isZero) return this;else if (this.isZero) return new NumberUnit(num._number, this.unit);
return new NumberUnit(this._number.add(num._number), this.unit);

@@ -308,2 +319,4 @@ }

num = this._coerceToNumberUnit(num);
if (num.unitType !== this.unitType) reportDifferentTypesDeprecated(this, num);
if (num.isZero) return this;else if (this.isZero) return new NumberUnit(num._number.neg(), this.unit);
return new NumberUnit(this._number.sub(num._number), this.unit);

@@ -425,2 +438,6 @@ }

get isPositive() {
return this._number.gt(new _bn.default(0));
}
get isZero() {

@@ -427,0 +444,0 @@ return this._number.isZero();

2

package.json
{
"name": "@exodus/currency",
"version": "1.0.4",
"version": "1.0.5",
"description": "Currency support.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -10,3 +10,3 @@ Exodus Currency

**It's currently only used in the mobile project.** It will be backported to Exotrack and Exodus Desktop.
**It's currently used in desktop and mobile.**

@@ -23,2 +23,19 @@ Install

```js
import assets from '@exodus/assets-base'
import { UnitType } from '@exodus/currency'
const ether = UnitType.create(assets.ethereum.units)
const e1 = ether.ETH(2)
const e2 = ether.parse('2 ETH')
const e3 = e2.to('wei')
const e4 = e3.add(ether.ETH(3))
const e5 = e4.toDefault()
const e6 = e5.toBase()
console.log(e1.equals(e2))
console.log(e2.equals(e3))
console.log(e4.toString())
console.log(e5.toString())
console.log(e6.toString())
```
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