From c14b0afb5a18f9212bbe4987d845d25530ec70e7 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Wed, 16 Dec 2020 18:42:26 +0000 Subject: [PATCH] created utils file --- websrc/utils.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 websrc/utils.ts diff --git a/websrc/utils.ts b/websrc/utils.ts new file mode 100644 index 0000000..3cb4ec3 --- /dev/null +++ b/websrc/utils.ts @@ -0,0 +1,12 @@ +import {CurrencyPair} from "./types"; + +export function symbolToPair(symbol: string): CurrencyPair { + const symbol_regex = "t(?[a-zA-Z]{3})(?[a-zA-Z]{3})" + + const match = symbol.match(symbol_regex) + + return { + base: match.groups.base, + quote: match.groups.quote + } +} \ No newline at end of file