From 1434938354af135fbbecc7b21969f134dc6fdbd2 Mon Sep 17 00:00:00 2001 From: Johannes Date: Tue, 18 Sep 2012 19:00:39 +0200 Subject: - Improved strict mode detection --- lib/detectStrictMode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/detectStrictMode.js') 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 -- cgit v1.2.3