created utils file
This commit is contained in:
parent
60db4f93e0
commit
c14b0afb5a
12
websrc/utils.ts
Normal file
12
websrc/utils.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import {CurrencyPair} from "./types";
|
||||||
|
|
||||||
|
export function symbolToPair(symbol: string): CurrencyPair {
|
||||||
|
const symbol_regex = "t(?<base>[a-zA-Z]{3})(?<quote>[a-zA-Z]{3})"
|
||||||
|
|
||||||
|
const match = symbol.match(symbol_regex)
|
||||||
|
|
||||||
|
return {
|
||||||
|
base: match.groups.base,
|
||||||
|
quote: match.groups.quote
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user