Skip to content

Commit e79fadc

Browse files
authored
v1.2.0 (#5)
* Add HOC * Update devDependencies * Add tests for useCurrency hook * Update devDependencies * Remove unused code from test * Add test command .travis.yml config * Update tsconfig.json * Remove test * Update devDependencies * Update * Update types * Update config * Rebuild withCurrency HOC * Update * Update * Reomve HOC * Update README.md * Add keepPrecision option * Update test * v1.2.0
1 parent 355a796 commit e79fadc

18 files changed

+3023
-157
lines changed

β€Ž.eslintrc.jsβ€Ž

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ module.exports = {
77
],
88
plugins: ['prettier', 'react-hooks'],
99
env: {
10-
browser: true
10+
browser: true,
11+
jest: true
1112
},
1213
parserOptions: {
1314
ecmaVersion: 6,
14-
sourceType: 'module',
15-
ecmaFeatures: {
16-
jsx: true
17-
}
15+
sourceType: 'module'
1816
},
1917
rules: {
2018
'react-hooks/rules-of-hooks': 'error',

β€Ž.gitignoreβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
.DS_Store
33
yarn-error.log
44
.rpt2_cache
5+
coverage

β€Ž.npmignoreβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
src
2+
test
3+
coverage
24

35
tsconfig.json
46
.travis.yml

β€Ž.travis.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ cache:
66
directories:
77
- node_modules
88

9-
script: yarn
9+
script: yarn test

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# react-currency-hooks Changelog
22

3+
## 1.2.0 (2020-02-23)
4+
#### New Feature
5+
- added option `keepPrecision`
6+
37
## 1.1.0 / 1.1.1 / 1.1.2 / 1.1.3 (2020-02-09)
48
#### New Feature
59
- support for multiple `to` values

β€ŽREADME.mdβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Name | Type | Default | Description
3636
**to** | string or string[] | ` ` | The currency to which it is converted
3737
**base** | string | ` ` | Base currency
3838
**rates** | Rates | `{}` | Currency rates
39+
**keepPrecision** | boolean | `true` | `true` (return exact values), `false` (return values rounded to 2 places)
3940

4041
#### Returned Values
4142
Type | Description
@@ -45,7 +46,7 @@ number or object with currencies passed in `to` | Converted value
4546
## Example
4647
```js
4748
import React from 'react';
48-
import { useCurrency } from 'react-viewport-hooks';
49+
import { useCurrency } from 'react-currency-hooks';
4950

5051
const App = () => {
5152
const rates = {

β€Žlib/index.d.tsβ€Ž

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
import { Options } from './interfaces/Options';
2-
import { Rates } from './types/rates';
3-
export declare const useCurrency: (amount: number, { from, to, base, rates }: Options) => number | Rates | undefined;
1+
export { useCurrency } from './useCurrency';

β€Žlib/interfaces/Options.d.tsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export interface Options {
44
readonly to: string | string[];
55
readonly base: string;
66
readonly rates: Readonly<Rates>;
7+
readonly keepPrecision?: boolean;
78
}

β€Žlib/react-currency-hooks.cjs.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žlib/react-currency-hooks.esm.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)