packages/path-matcher/src/compileTree.js
function globsToRegExpStr(str) {
    return str.split(STRING_TESTS.GLOBSTAR)
            // => [ theWholeTextIfThereIsNoGlobstar, "**", everythingAfter ]
            .map((v, i) =>
                (i + 1) % 2 === 0 ? // (**) part
                                    // Replace unescaped '**' glob
                    v.replace(STRING_TESTS.GLOBSTAR, (_match, _p1, p2) =>
                        `([^\\/]+\/+)*${p2 ? `[^\\/]*${p2}` : ''}`)
                    : (i + 1) % 3 === 0 ? // (everythingElse) part
                        (v ? `[^\\/]*${v}` : '')
                    : // Else
                    // Replace unescaped '*' glob
                    v.replace(STRING_TESTS.STAR, '$1([^\\/]*)'))
            .join('');
}
function globsToRegExpStr(str) {
    return str.split(STRING_TESTS.GLOBSTAR)
            // => [ theWholeTextIfThereIsNoGlobstar, "**", everythingAfter ]
            .map((v, i) =>
                (i + 1) % 2 === 0 ? // (**) part
                                    // Replace unescaped '**' glob
                    v.replace(STRING_TESTS.GLOBSTAR, (_match, _p1, p2) =>
                        `([^\\/]+\/+)*${p2 ? `[^\\/]*${p2}` : ''}`)
                    : (i + 1) % 3 === 0 ? // (everythingElse) part
                        (v ? `[^\\/]*${v}` : '')
                    : // Else
                    // Replace unescaped '*' glob
                    v.replace(STRING_TESTS.STAR, '$1([^\\/]*)'))
            .join('');
}
function globsToRegExpStr ( str ) { return str . split ( STRING_TESTS . GLOBSTAR ) // => [ theWholeTextIfThereIsNoGlobstar, "**", everythingAfter ] . map ( ( v , i ) => ( i + 1 ) % 2 === 0 ? // (**) part // Replace unescaped '**' glob v . replace ( STRING_TESTS . GLOBSTAR , ( _match , _p1 , p2 ) => ` \\ \/ ${ p2 ? ` \\ ${ p2 } ` : '' } ` ) : ( i + 1 ) % 3 === 0 ? // (everythingElse) part ( v ? ` \\ ${ v } ` : '' ) : // Else // Replace unescaped '*' glob v . replace ( STRING_TESTS . STAR , '$1([^\\/]*)' ) ) . join ( '' ) ; }
Transform globs into RegExp string
Transform globs into RegExp string