@makerdao/currency
Advanced tools
Comparing version 0.9.3 to 0.9.5
@@ -176,2 +176,5 @@ 'use strict'; | ||
if (!(right instanceof Currency) || left.isSameType(right)) { | ||
if (left instanceof CurrencyRatio) { | ||
return new left.constructor(value, left.numerator, left.denominator, left.shift); | ||
} | ||
return new left.constructor(value); | ||
@@ -178,0 +181,0 @@ } |
{ | ||
"name": "@makerdao/currency", | ||
"description": "Utilities for working with currency amounts", | ||
"version": "0.9.3", | ||
"version": "0.9.5", | ||
"license": "MIT", | ||
@@ -11,2 +11,10 @@ "main": "dist/index.js", | ||
}, | ||
"files": [ | ||
"package.json", | ||
"README.md", | ||
"LICENSE", | ||
"src/**/*.js", | ||
"dist/**/*.js", | ||
"test/**/*.js" | ||
], | ||
"devDependencies": { | ||
@@ -13,0 +21,0 @@ "babel-cli": "^6.26.0", |
# @makerdao/currency | ||
A set of utilities for working with currencies on Ethereum, extracted from | ||
[dai.js](https://github.com/makerdao/dai.js). | ||
[dai.js](https://github.com/makerdao/dai.js). Available as an [NPM module](https://www.npmjs.com/package/@makerdao/currency). | ||
Check out the test file to see how this is used. |
@@ -106,3 +106,3 @@ import BigNumber from 'bignumber.js'; | ||
case 'div': | ||
return; | ||
return; | ||
} | ||
@@ -125,2 +125,10 @@ } | ||
if (!(right instanceof Currency) || left.isSameType(right)) { | ||
if (left instanceof CurrencyRatio) { | ||
return new left.constructor( | ||
value, | ||
left.numerator, | ||
left.denominator, | ||
left.shift | ||
); | ||
} | ||
return new left.constructor(value); | ||
@@ -127,0 +135,0 @@ } |
@@ -126,2 +126,7 @@ import { | ||
test('basic math with ratios', () => { | ||
const val = USD_DAI(10); | ||
expect(val.times(10)).toEqual(USD_DAI(100)); | ||
}); | ||
test('instanceof Currency', () => { | ||
@@ -128,0 +133,0 @@ expect(ETH(5) instanceof Currency).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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
701
0
28583
8