@icgio/icg-utils 1.9.6 → 1.9.7

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.
@@ -1 +1 @@
1
- module.exports = ['BUSD', 'CUSD', 'DAI', 'FEI', 'FRAX', 'GUSD', 'PAX', 'SUSD', 'TUSD', 'USD', 'USDC', 'USDD', 'USDJ', 'USDK', 'USDP', 'USDT']
1
+ module.exports = ['DAI', 'FEI', 'FRAX', 'GUSD', 'PAX', 'SUSD', 'TUSD', 'USD', 'USDC', 'USDD', 'USDJ', 'USDK', 'USDP', 'USDT']
package/lib/utils.js CHANGED
@@ -777,14 +777,12 @@ module.exports.parse_pair = function (pair) {
777
777
  pair = pair.toUpperCase()
778
778
  let time
779
779
  ;[pair, time] = _.split(pair, '_')
780
- let result = ''
781
- if (stablecoins.some((c) => pair.endsWith(c))) {
782
- let stablecoin = stablecoins.find((c) => pair.endsWith(c))
783
- result = [pair.substr(0, pair.length - stablecoin.length), pair.substr(pair.length - stablecoin.length, pair.length)]
784
- } else if (pair.endsWith('QC')) {
785
- result = [pair.substr(0, pair.length - 2), pair.substr(pair.length - 2, pair.length)]
780
+ let result = []
781
+ let stablecoin = stablecoins.find((c) => pair.endsWith(c))
782
+ if (stablecoin) {
783
+ result = [pair.slice(0, -stablecoin.length), stablecoin]
786
784
  } else {
787
- result = [pair.substr(0, pair.length - 3), pair.substr(pair.length - 3, pair.length)]
785
+ result = [pair.slice(0, -3), pair.slice(-3)]
788
786
  }
789
787
  if (time) {
790
788
  result[1] += '_' + time
@@ -852,3 +850,5 @@ module.exports.random_normal_range = (mean, std_dev, a, b) => {
852
850
  // Clip to range
853
851
  return Math.max(min, Math.min(max, num))
854
852
  }
853
+
854
+ console.log(module.exports.parse_pair('BTCUSD'))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.9.6",
3
+ "version": "1.9.7",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {