@exodus/currency
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -0,1 +1,6 @@ | ||
1.0.2 / 2019-06-19 | ||
------------------ | ||
- Parameter type checking in conversion-by-rate | ||
1.0.1 / 2019-06-12 | ||
@@ -2,0 +7,0 @@ ------------------ |
@@ -8,3 +8,8 @@ "use strict"; | ||
var _unitType = _interopRequireDefault(require("./unit-type")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function conversionByRate(ut1, ut2, rate, opts = {}) { | ||
if (!(ut1 instanceof _unitType.default) || !(ut2 instanceof _unitType.default)) throw new Error('Must pass in an instance of UnitType for ut1 and ut2.'); | ||
const { | ||
@@ -17,2 +22,4 @@ unit1, | ||
}, opts); | ||
if (!ut1[unit1]) throw new Error(`unit1 (${unit1}) is not from ut1`); | ||
if (!ut2[unit2]) throw new Error(`unit2 (${unit2}) is not from ut2`); | ||
@@ -19,0 +26,0 @@ let converter = function converter(someNumberUnit) { |
@@ -63,3 +63,6 @@ "use strict"; | ||
} = {}) { | ||
if (typeof num === 'number') num = num.toString();else num = num.toLowerCase(); | ||
if (typeof num === 'number') { | ||
if (num === Infinity || num === -Infinity) throw new Error('Infinity is not supported'); | ||
num = num.toString(); | ||
} else num = num.toLowerCase(); | ||
@@ -66,0 +69,0 @@ if (num.length > 2 && num[0] === '0' && num[1] === 'x') { |
{ | ||
"name": "@exodus/currency", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Currency support.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
18852
485