Huge News!Announcing our $40M Series B led by Abstract Ventures.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.1.6 to 2.0.0

4

lib/conversion-by-rate.js

@@ -27,7 +27,7 @@ "use strict";

if (ut === ut1) {
if (ut.equals(ut1)) {
const newUnit = ut2.baseUnit(someNumberUnit._number).mul(ut2[unit2].multiplier).mul(rate);
newUnit._number = newUnit._number.div(ut1[unit1].multiplier);
return newUnit.to(unit2);
} else if (ut === ut2) {
} else if (ut.equals(ut2)) {
let newUnit = ut1.baseUnit(someNumberUnit._number).mul(ut1[unit1].multiplier);

@@ -34,0 +34,0 @@

@@ -18,7 +18,7 @@ "use strict";

if (ut === ut1) {
if (ut.equals(ut1)) {
let normalizeNum = someNumberUnit.to(num1.unitName);
let newNumber = num1.isZero ? num1.unitType.ZERO._number : normalizeNum._number.mul(num2._number).div(num1._number);
return ut2[num2.unitName](newNumber).to(num2.unitName);
} else if (ut === ut2) {
} else if (ut.equals(ut2)) {
let normalizeNum = someNumberUnit.to(num2.unitName);

@@ -25,0 +25,0 @@ let newNumber = num2.isZero ? num2.unitType.ZERO._number : normalizeNum._number.mul(num1._number).div(num2._number);

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

});
exports.default = exports.maybeReportDifferentTypesDeprecated = void 0;
exports.maybeReportDifferentTypesDeprecated = exports.default = void 0;

@@ -19,3 +19,3 @@ const deprecationWarning = message => {

const maybeReportDifferentTypesDeprecated = (num, otherNum, operation) => {
if (num.unitType !== otherNum.unitType) deprecationWarning(`DEPRECATION WARNING: number-unit.${operation} on different NumberUnit types (${num}, ${otherNum}) is not correct and will be removed soon`);
if (!num.unitType.equals(otherNum.unitType)) deprecationWarning(`DEPRECATION WARNING: number-unit.${operation} on different NumberUnit types (${num}, ${otherNum}) is not correct and will be removed soon`);
};

@@ -22,0 +22,0 @@

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

});
exports.UnitType = exports.conversionByRate = exports.conversion = exports.isNumberUnit = exports.default = void 0;
exports.isNumberUnit = exports.default = exports.conversionByRate = exports.conversion = exports.UnitType = void 0;

@@ -9,0 +9,0 @@ var _numberUnit = _interopRequireDefault(require("./number-unit"));

@@ -20,4 +20,6 @@ "use strict";

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -355,7 +357,7 @@

if (this.unit.unitType !== unit.unitType) {
if (!this.unit.unitType.equals(unit.unitType)) {
if (!conversionUnit) throw new Error('Incompatible unit types. Must specify a conversion.');
if (typeof conversionUnit !== 'function') {
if (this.unitType !== conversionUnit.from.unitType) {
if (!this.unitType.equals(conversionUnit.from.unitType)) {
throw new Error('Conversion unit from is of different type.');

@@ -362,0 +364,0 @@ }

@@ -41,2 +41,6 @@ "use strict";

equals(other) {
return this === other || this.toString() === other.toString();
}
parse(str) {

@@ -43,0 +47,0 @@ const [amount, unit] = str.split(' ');

{
"name": "@exodus/currency",
"version": "1.1.6",
"version": "2.0.0",
"description": "Currency support.",

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

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