react-currency-conversion 1.0.3 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CurrenyConversion.jsx +12 -3
- package/package.json +11 -10
- package/readme.markdown +3 -3
- package/.npmignore +0 -2
package/CurrenyConversion.jsx
CHANGED
|
@@ -8,11 +8,19 @@ class CurrenyConversion extends React.Component {
|
|
|
8
8
|
super()
|
|
9
9
|
this.state = { val: 0 }
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
getDefaultProps() {
|
|
13
|
+
return {
|
|
14
|
+
date: 'latest'
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
componentDidMount() {
|
|
12
19
|
var from = this.props.from,
|
|
13
|
-
to
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
to = this.props.to,
|
|
21
|
+
date = this.props.date,
|
|
22
|
+
val = this.props.val,
|
|
23
|
+
API =`http://api.fixer.io/${date}?base=${from}&symbols=${from},${to}`
|
|
16
24
|
fetch(API)
|
|
17
25
|
.then(response => response.json())
|
|
18
26
|
.then(data => this.setState({val:data['rates'][to] * val}))
|
|
@@ -29,5 +37,6 @@ class CurrenyConversion extends React.Component {
|
|
|
29
37
|
CurrenyConversion.propTypes = {
|
|
30
38
|
from: React.PropTypes.string.isRequired,
|
|
31
39
|
to: React.PropTypes.string.isRequired,
|
|
40
|
+
date: React.PropTypes.string,
|
|
32
41
|
val: React.PropTypes.string.isRequired
|
|
33
42
|
}
|
package/package.json
CHANGED
|
@@ -9,20 +9,21 @@
|
|
|
9
9
|
"dev-build": "NODE_ENV=development browserify CurrenyConversion.jsx > public/bundle.js",
|
|
10
10
|
"prod-build": "NODE_ENV=production browserify CurrenyConversion.jsx | uglifyjs -cm > public/bundle.js",
|
|
11
11
|
"start": "ecstatic -p 8000 public",
|
|
12
|
-
"watch": "watchify main.js -o public/bundle.js -dv"
|
|
12
|
+
"watch": "watchify main.js -o public/bundle.js -dv",
|
|
13
|
+
"test": "node -e \"JSON.parse(require('fs').readFileSync('package.json','utf8'))\""
|
|
13
14
|
},
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"babelify": "^
|
|
16
|
-
"browserify": "^
|
|
17
|
-
"ecstatic": "
|
|
18
|
-
"es6-promise": "^
|
|
19
|
-
"isomorphic-fetch": "^
|
|
20
|
-
"react": "~
|
|
21
|
-
"uglify-js": "^
|
|
22
|
-
"watchify": "^
|
|
16
|
+
"babelify": "^10.0.0",
|
|
17
|
+
"browserify": "^17.0.1",
|
|
18
|
+
"ecstatic": "^4.1.4",
|
|
19
|
+
"es6-promise": "^4.2.8",
|
|
20
|
+
"isomorphic-fetch": "^3.0.0",
|
|
21
|
+
"react": "~19.3.0",
|
|
22
|
+
"uglify-js": "^3.19.3",
|
|
23
|
+
"watchify": "^4.0.0"
|
|
23
24
|
},
|
|
24
25
|
"description": "Converts given currency pair and value.",
|
|
25
|
-
"version": "1.0.
|
|
26
|
+
"version": "1.0.6",
|
|
26
27
|
"main": "CurrenyConversion.jsx",
|
|
27
28
|
"devDependencies": {},
|
|
28
29
|
"repository": {
|
package/readme.markdown
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# react-
|
|
1
|
+
# react-currency-conversion
|
|
2
2
|
> Exchange rate for a given currency pair and value.
|
|
3
3
|
|
|
4
|
-
__Install it:__ `npm install --save react-
|
|
4
|
+
__Install it:__ `npm install --save react-currency-conversion`
|
|
5
5
|
|
|
6
6
|
``` js
|
|
7
|
-
import 'ExchangeRate' from react-
|
|
7
|
+
import 'ExchangeRate' from react-currency-conversion;
|
|
8
8
|
React.render(<ExchangeRate from='USD' to='INR' val='100.20'/>,
|
|
9
9
|
document.querySelector('#content'));
|
|
10
10
|
```
|
package/.npmignore
DELETED