mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Cleanup strict build.
Former-commit-id: c34b2e7e2810e8bc35bde3e0f962d925b3f5ba1b
This commit is contained in:
9
build.js
9
build.js
@@ -1153,13 +1153,12 @@
|
||||
* @returns {String} Returns the modified source.
|
||||
*/
|
||||
function setUseStrictOption(source, value) {
|
||||
// inject "use strict"
|
||||
if (value) {
|
||||
source = source.replace(/^[\s\S]*?function[^{]+{/, "$&\n 'use strict';");
|
||||
}
|
||||
// inject or remove the "use strict" directive
|
||||
source = source.replace(/(^[\s\S]*?function[^{]+{)(?:\s*'use strict';)?/, '$1' + (value ? "\n 'use strict';" : ''));
|
||||
|
||||
// replace `strict` branch in `iteratorTemplate` with hard-coded option
|
||||
source = source.replace(getIteratorTemplate(source), function(match) {
|
||||
return match.replace(/(?: *\/\/.*\n)*(\s*)["'] *<%.+?strict.+/, value ? '$1"\'use strict\';\\n" +' : '');
|
||||
return match.replace(/(template\()(?:\s*"'use strict.+)?/, '$1' + (value ? '\n "\'use strict\';\\n" +' : ''));
|
||||
});
|
||||
|
||||
return source;
|
||||
|
||||
Reference in New Issue
Block a user