Created
December 17, 2017 19:37
-
-
Save snowkidind/d7e73580948748c3a9b8345db16a5f57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// again, thirty second code here, bugs and needs factoring ensue | |
toBtx: function(string){ | |
// bittrex likes all caps | |
// btx also likes btc, usdt, or eth at the beginning | |
let raw = String(string).toUpperCase(); | |
let raw2 = ""; | |
if (raw.includes("BTC")){ | |
const raw1 = raw.replace(/BTC/g, ""); | |
raw2 = "BTC-" + raw1; | |
} | |
else if (raw.includes("USDT")){ | |
const raw1 = raw.replace(/USDT/g, ""); | |
raw2 = "USDT-" + raw1; | |
} | |
if(raw.includes("ETH")){ | |
if (raw.includes("BTC")){ | |
raw2 = "BTC-ETH"; | |
} | |
else if (raw.includes("USDT")){ | |
raw2 = "USDT-ETH"; | |
} | |
else { | |
const raw1 = raw.replace(/ETH/g, ""); | |
raw2 = "ETH-" + raw1; | |
} | |
} | |
return raw2; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment