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

detectStrictMode.js « lib - github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 347c455f3e88c7ccb7e167d363e4040726b39251 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/**
 * Returns true if the source code is intended to run in strict mode. Does not detect
 * "use strict" if it occurs in a nested function.
 *
 * @param {!String} src
 * @return {Boolean}
 */
function detectStrictMode(src) {
    return (/^\s*"use strict";/g).test(src);
}

module.exports = detectStrictMode;