File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,6 @@ import chalk from 'chalk'
33const ERROR = chalk . bold . red
44const SUCCESS = chalk . bold . green
55
6- const formatter = new Intl . NumberFormat ( 'en-US' , {
7- style : 'currency' ,
8- currency : 'USD'
9- } )
10-
116export const logError = ( message : string ) => {
127 console . error ( ERROR ( message ) )
138 process . exit ( 1 )
@@ -18,7 +13,16 @@ export const logSuccess = (message: string) => {
1813}
1914
2015export const format = ( price : number ) => {
21- return formatter . format ( price )
16+ const decimalPart = price . toString ( ) . split ( '.' ) [ 1 ]
17+ // If the decimal part starts with 0000, it's likely a meme coin
18+ // and we want to show more decimal places to avoid showing 0.00
19+ const isMemeCoin = decimalPart && decimalPart . slice ( 0 , 4 ) === '0000'
20+
21+ return new Intl . NumberFormat ( 'en-US' , {
22+ style : 'currency' ,
23+ currency : 'USD' ,
24+ maximumFractionDigits : isMemeCoin ? 10 : 2
25+ } ) . format ( price )
2226}
2327
2428export const formatFileName = ( coinName : string , fileExt : string ) : string => {
You can’t perform that action at this time.
0 commit comments