Skip to content

Commit 43cce70

Browse files
committed
Enhance getting ccy pair for currency conversion
1 parent 069fcb1 commit 43cce70

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

  • workers/loc.api/sync/currency.converter

workers/loc.api/sync/currency.converter/index.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,25 @@ class CurrencyConverter {
348348
if (typeof symbol !== 'string') {
349349
return ''
350350
}
351-
if (symbol.length < 8) {
351+
if (symbol.length < 6) {
352352
return symbol
353353
}
354+
355+
const hasFlag = (
356+
symbol.startsWith('t') ||
357+
symbol.startsWith('f')
358+
)
359+
const flag = hasFlag
360+
? symbol[0]
361+
: 't'
362+
354363
if (
355-
symbol[0] !== 't' &&
356-
symbol[0] !== 'f'
364+
symbol.length === 7 &&
365+
hasFlag
357366
) {
358367
return symbol
359368
}
360369

361-
const flag = symbol[0]
362370
const [firstSymb, lastSymb] = splitSymbolPairs(symbol)
363371
const _firstSymb = this._getConvertingSymb(firstSymb)
364372
const _lastSymb = this._getConvertingSymb(lastSymb)

0 commit comments

Comments
 (0)