12 lines
304 B
TypeScript
12 lines
304 B
TypeScript
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
|
|
}
|
|
} |