File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,12 +109,16 @@ function expandScientificNotation(parsed: ParsedScientificNotation) {
109109 const initialDecimalIndex = integerDigits || - leadingDecimalZeros ;
110110 const decimalIndex = initialDecimalIndex + exponent ;
111111
112- const expanded =
113- decimalIndex <= 0
114- ? `0.${ '0' . repeat ( - decimalIndex ) } ${ digits } `
115- : decimalIndex >= digits . length
116- ? `${ digits } ${ '0' . repeat ( decimalIndex - digits . length ) } `
117- : `${ digits . slice ( 0 , decimalIndex ) } .${ digits . slice ( decimalIndex ) } ` ;
112+ // eslint-disable-next-line no-useless-assignment
113+ let expanded = '' ;
114+
115+ if ( decimalIndex <= 0 ) {
116+ expanded = `0.${ '0' . repeat ( - decimalIndex ) } ${ digits } ` ;
117+ } else if ( decimalIndex >= digits . length ) {
118+ expanded = `${ digits } ${ '0' . repeat ( decimalIndex - digits . length ) } ` ;
119+ } else {
120+ expanded = `${ digits . slice ( 0 , decimalIndex ) } .${ digits . slice ( decimalIndex ) } ` ;
121+ }
118122
119123 return `${ negative ? '-' : '' } ${ expanded } ` ;
120124}
You can’t perform that action at this time.
0 commit comments