mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-06-12 18:51:02 +00:00
Use loop instead of find (better RN support) (#80)
This commit is contained in:
@@ -36,5 +36,12 @@ export function calcSi (text: string, decimals: number): SiDef {
|
||||
|
||||
// Given a SI type (e.g. k, m, Y) find the SI definition
|
||||
export function findSi (type: string): SiDef {
|
||||
return SI.find(({ value }) => value === type) || SI[SI_MID];
|
||||
// use a loop here, better RN support (which doesn't have [].find)
|
||||
for (let i = 0; i < SI.length; i++) {
|
||||
if (SI[i].value === type) {
|
||||
return SI[i];
|
||||
}
|
||||
}
|
||||
|
||||
return SI[SI_MID];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user