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

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes <johannes.ewald@roomieplanet.de>2012-09-18 21:00:39 +0400
committerJohannes <johannes.ewald@roomieplanet.de>2012-09-18 21:03:33 +0400
commit1434938354af135fbbecc7b21969f134dc6fdbd2 (patch)
tree745d790927371ca8133da54181e8c9caacdd0559 /lib/detectStrictMode.js
parent203b81607a82eb360113efbe8f63d2ed454c5a48 (diff)
- Improved strict mode detection
Diffstat (limited to 'lib/detectStrictMode.js')
-rw-r--r--lib/detectStrictMode.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/detectStrictMode.js b/lib/detectStrictMode.js
index 347c455..35f27fb 100644
--- a/lib/detectStrictMode.js
+++ b/lib/detectStrictMode.js
@@ -2,11 +2,11 @@
* 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
+ * @param {String} src
* @return {Boolean}
*/
function detectStrictMode(src) {
- return (/^\s*"use strict";/g).test(src);
+ return (/^\s*(?:"use strict"|'use strict')[ \t]*(?:[\r\n]|;)/g).test(src);
}
module.exports = detectStrictMode; \ No newline at end of file