Welcome to mirror list, hosted at ThFree Co, Russian Federation.

getRewireRequires.js « browserify « lib - github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c8b0f01b5b0822416338fec20c3e272eeb2002b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function getRewireRequires(src) {
    var result = [],
        regExp = /[^a-zA-Z0-9_]rewire\(["'](.+?)["']\)/g,
        match;

    src = " " + src;    // ensure that rewire() is not at index 0 otherwise the regexp won't work in this case
    match = regExp.exec(src);
    while (match !== null) {
        result.push(match[1]);
        match = regExp.exec(src);
    }

    return result;
}

module.exports = getRewireRequires;