File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ const where = (conditions, firstArgIndex = 1) => {
2323 }
2424 if ( value . includes ( '*' ) || value . includes ( '?' ) ) {
2525 operator = 'LIKE' ;
26- value = value . replace ( / \* / g , '%' ) . replace ( / \? / g , '_' ) ;
26+ value = value . replace ( '*' , '%' ) . replace ( '?' , '_' ) ;
2727 }
2828 }
2929 clause . push ( `${ key } ${ operator } $${ i ++ } ` ) ;
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ class Logger {
1818 const date = new Date ( ) . toISOString ( ) . substring ( 0 , 10 ) ;
1919 const filePath = path . join ( logPath , `${ date } -W${ threadId } .log` ) ;
2020 this . stream = fs . createWriteStream ( filePath , { flags : 'a' } ) ;
21- this . regexp = new RegExp ( path . dirname ( this . path ) , 'g' ) ;
21+ this . home = path . dirname ( this . path ) ;
2222 }
2323
2424 close ( ) {
@@ -31,7 +31,7 @@ class Logger {
3131 const color = COLORS [ level ] ;
3232 const line = date + '\t' + s ;
3333 console . log ( color + line + '\x1b[0m' ) ;
34- const out = line . replace ( / [ \n \r ] \s * / g , '; ' ) + '\n' ;
34+ const out = line . replaceAll ( '\n' , '; ' ) + '\n' ;
3535 this . stream . write ( out ) ;
3636 }
3737
@@ -51,8 +51,8 @@ class Logger {
5151 }
5252
5353 error ( ...args ) {
54- const msg = util . format ( ...args ) . replace ( / [ \n \r ] { 2 , } / g , '\n' ) ;
55- this . write ( 'error' , msg . replace ( this . regexp , '' ) ) ;
54+ const msg = util . format ( ...args ) ;
55+ this . write ( 'error' , msg . replaceAll ( this . home , '' ) ) ;
5656 }
5757
5858 system ( ...args ) {
You can’t perform that action at this time.
0 commit comments