@icgio/icg-utils 1.9.33 → 1.9.34

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/lib/forex-rate.js CHANGED
@@ -1,13 +1,16 @@
1
1
  const needle = require('needle')
2
2
  const utils = require('./utils.js')
3
3
 
4
- let get_forex_rate_usd = function (pair, cb) {
5
- let [cur, quote_cur] = utils.parse_pair(pair)
4
+ let get_forex_rate_usd = function (cur, cb) {
6
5
  needle.get(`https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/usd.json`, (err, res, body) => {
7
6
  if (body && body.usd) {
8
- cb(body.usd[quote_cur.toLowerCase()])
7
+ cb(1 / body.usd[cur.toLowerCase()])
9
8
  }
10
9
  })
11
10
  }
12
11
 
13
- module.exports.get_forex_rate = get_forex_rate_usd
12
+ module.exports.get_forex_rate_usd = get_forex_rate_usd
13
+
14
+ // get_forex_rate_usd('CNY', (rate) => {
15
+ // console.log(rate)
16
+ // })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.9.33",
3
+ "version": "1.9.34",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {