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 @@ -642,15 +642,19 @@ function isSetup() {
642
642
function joinRegExp ( patterns ) {
643
643
// Combine an array of regular expressions and strings into one large regexp
644
644
// Be mad.
645
- var sources = [ ] , len = patterns . length ;
646
- for ( var i = 0 ; i < len ; i ++ ) {
647
- if ( isString ( patterns [ i ] ) ) {
645
+ var sources = [ ] ,
646
+ i = 0 , len = patterns . length ,
647
+ pattern ;
648
+
649
+ for ( ; i < len ; i ++ ) {
650
+ pattern = patterns [ i ] ;
651
+ if ( isString ( pattern ) ) {
648
652
// If it's a string, we need to escape it
649
653
// Taken from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
650
- sources . push ( patterns [ i ] . replace ( / ( [ . * + ? ^ = ! : $ { } ( ) | \[ \] \/ \\ ] ) / g, "\\$1" ) ) ;
651
- } else if ( patterns [ i ] && patterns [ i ] . source ) {
654
+ sources . push ( pattern . replace ( / ( [ . * + ? ^ = ! : $ { } ( ) | \[ \] \/ \\ ] ) / g, "\\$1" ) ) ;
655
+ } else if ( pattern && pattern . source ) {
652
656
// If it's a regexp already, we want to extract the source
653
- sources . push ( patterns [ i ] . source ) ;
657
+ sources . push ( pattern . source ) ;
654
658
}
655
659
// Intentionally skip other cases
656
660
}
You can’t perform that action at this time.
0 commit comments