@icgio/icg-utils 1.7.61 → 1.7.63

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.
@@ -342,7 +342,7 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
342
342
  try {
343
343
  const asks = res.body.data.a
344
344
  const bids = res.body.data.b
345
- let rate = (parseFloat(asks[0][0]) + parseFloat(bids[0][0])) / 2
345
+ let rate = parseFloat(asks[0][0])
346
346
  result.GPT = {
347
347
  USD: rate,
348
348
  USDT: rate,
package/lib/utils.js CHANGED
@@ -27,19 +27,30 @@ const stablecoins = require('../constants/stablecoins')
27
27
  // console.log(0.000000000000000000000000001232312421.toFixed(30))
28
28
 
29
29
  Number.prototype.toStringNoExponents = function () {
30
- let data = String(this).split(/[eE]/)
31
- if (data.length == 1) return data[0]
30
+ let data
31
+ if (_.isString(this)) {
32
+ data = this.split(/[eE]/)
33
+ } else {
34
+ data = String(this).split(/[eE]/)
35
+ }
36
+ if (data.length == 1) {
37
+ return data[0]
38
+ }
32
39
  let z = '',
33
40
  sign = this < 0 ? '-' : '',
34
41
  str = data[0].replace('.', ''),
35
42
  mag = Number(data[1]) + 1
36
43
  if (mag < 0) {
37
44
  z = sign + '0.'
38
- while (mag++) z += '0'
45
+ while (mag++) {
46
+ z += '0'
47
+ }
39
48
  return z + str.replace(/^\-/, '')
40
49
  }
41
50
  mag -= str.length
42
- while (mag--) z += '0'
51
+ while (mag--) {
52
+ z += '0'
53
+ }
43
54
  return str + z
44
55
  }
45
56
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.7.61",
3
+ "version": "1.7.63",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {