File tree Expand file tree Collapse file tree 2 files changed +20
-24
lines changed Expand file tree Collapse file tree 2 files changed +20
-24
lines changed Original file line number Diff line number Diff line change @@ -562,20 +562,18 @@ const underbarPrefix = new RegExp('^_');
562562 */
563563function applyRules ( str , rules , skip , override ) {
564564 if ( override ) {
565- str = override ;
565+ return override ;
566566 }
567567 else {
568- const ignore = skip . indexOf ( str . toLocaleLowerCase ( ) ) > - 1 ;
569- if ( ! ignore ) {
570- const j = rules . length ;
571- for ( let i = 0 ; i < j ; i ++ ) {
572- if ( str . match ( rules [ i ] [ 0 ] ) ) {
573- const replaceRule = rules [ i ] [ 1 ] ;
574- if ( replaceRule !== undefined ) {
575- str = str . replace ( rules [ i ] [ 0 ] , replaceRule ) ;
576- }
577- break ;
568+ if ( skip . includes ( str . toLocaleLowerCase ( ) ) ) {
569+ return str ;
570+ }
571+ for ( const rule of rules ) {
572+ if ( str . match ( rule [ 0 ] ) ) {
573+ if ( rule [ 1 ] !== undefined ) {
574+ return str . replace ( rule [ 0 ] , rule [ 1 ] ) ;
578575 }
576+ return str ;
579577 }
580578 }
581579 }
Original file line number Diff line number Diff line change @@ -604,21 +604,19 @@ function applyRules(
604604 override ?: string
605605) {
606606 if ( override ) {
607- str = override ;
607+ return override ;
608608 } else {
609- const ignore = skip . indexOf ( str . toLocaleLowerCase ( ) ) > - 1 ;
610-
611- if ( ! ignore ) {
612- const j = rules . length ;
613-
614- for ( let i = 0 ; i < j ; i ++ ) {
615- if ( str . match ( rules [ i ] [ 0 ] ) ) {
616- const replaceRule = rules [ i ] [ 1 ] ;
617- if ( replaceRule !== undefined ) {
618- str = str . replace ( rules [ i ] [ 0 ] , replaceRule ) ;
619- }
620- break ;
609+ if ( skip . includes ( str . toLocaleLowerCase ( ) ) ) {
610+ return str ;
611+ }
612+
613+ for ( const rule of rules ) {
614+ if ( str . match ( rule [ 0 ] ) ) {
615+ if ( rule [ 1 ] !== undefined ) {
616+ return str . replace ( rule [ 0 ] , rule [ 1 ] ) ;
621617 }
618+
619+ return str ;
622620 }
623621 }
624622 }
You can’t perform that action at this time.
0 commit comments