File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ export default class NumberFormat {
3333  input : Input 
3434  number : Input 
3535  isClean : boolean 
36+   isCustomDecimal : boolean 
3637  preSurRegExp : RegExp 
3738  numberRegExp : RegExp 
3839  cleanRegExp : RegExp 
@@ -53,6 +54,7 @@ export default class NumberFormat {
5354    this . numberRegExp  =  new  RegExp ( `[^0-9\\${ decimal }  ]+` ,  'gi' ) 
5455    this . cleanRegExp  =  new  RegExp ( '[^0-9]+' ,  'gi' ) 
5556    this . negativeRegExp  =  new  RegExp ( '[^0-9\\-]+' ,  'gi' ) 
57+     this . isCustomDecimal  =  decimal  !==  '.' 
5658  } 
5759
5860  isNull ( )  { 
@@ -98,15 +100,19 @@ export default class NumberFormat {
98100
99101  numbers ( )  { 
100102    const  {  reverseFill,  decimal }  =  this . options 
103+     const  hasDeciaml  =  this . input . toString ( ) . indexOf ( decimal )  >=  0 
104+     const  input  =  ! hasDeciaml  &&  this . isCustomDecimal  ? this . input  +  decimal  : this . input 
105+ 
101106    if  ( reverseFill )  { 
102107      this . number  =  this . toFixed ( ) . replace ( '.' ,  decimal ) 
103108    }  else  if  ( typeof  this . input  ===  'number' )  { 
104109      this . number  =  this . parts ( this . input . toString ( ) . replace ( '-' ,  '' ) ,  '.' ) . join ( decimal ) 
105-     }  else  if  ( ! isNaN ( this . toNumber ( this . input ) ) )  { 
110+     }  else  if  ( ! isNaN ( this . toNumber ( input ) ) )  { 
106111      this . number  =  this . parts ( this . input . replace ( '-' ,  '' ) ,  '.' ) . join ( decimal ) 
107112    }  else  { 
108113      this . number  =  this . parts ( this . numberOnly ( ) ) . join ( decimal ) 
109114    } 
115+ 
110116    return  this . number 
111117  } 
112118
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments