@makerdao/currency
Advanced tools
Comparing version 0.9.8 to 0.9.9
@@ -50,3 +50,2 @@ 'use strict'; | ||
var value = (0, _bignumber2.default)(amount); | ||
if (value.lt(0)) throw new Error('amount cannot be negative'); | ||
if (value.isNaN()) throw new Error('amount "' + amount + '" is not a number'); | ||
@@ -53,0 +52,0 @@ return value; |
{ | ||
"name": "@makerdao/currency", | ||
"description": "Utilities for working with currency amounts", | ||
"version": "0.9.8", | ||
"version": "0.9.9", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
@@ -8,3 +8,2 @@ import BigNumber from 'bignumber.js'; | ||
const value = BigNumber(amount); | ||
if (value.lt(0)) throw new Error('amount cannot be negative'); | ||
if (value.isNaN()) throw new Error(`amount "${amount}" is not a number`); | ||
@@ -11,0 +10,0 @@ return value; |
@@ -61,8 +61,2 @@ import { createCurrency, createGetCurrency } from '../src'; | ||
test('throws an error if amount is negative', () => { | ||
expect(() => { | ||
getCurrency('-1', 'eth'); | ||
}).toThrowError('amount cannot be negative'); | ||
}); | ||
test('throws an error if symbol is unrecognized', () => { | ||
@@ -69,0 +63,0 @@ expect(() => { |
import { Currency, createCurrency, createCurrencyRatio } from '../src'; | ||
import BigNumber from 'bignumber.js'; | ||
@@ -148,1 +149,6 @@ const DAI = createCurrency('DAI'); | ||
}); | ||
test('constructor flexibility', () => { | ||
const val = ETH({ toBigNumber: () => BigNumber(5) }); | ||
expect(val.eq(5)).toBeTruthy(); | ||
}); |
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
29095
711