mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +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;
|
||||
|
||||
3269
doc/RADME.md
Normal file
3269
doc/RADME.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -354,9 +354,6 @@
|
||||
* @returns {String} Returns the interpolated text.
|
||||
*/
|
||||
var iteratorTemplate = template(
|
||||
// conditional strict mode
|
||||
"<% if (obj.useStrict) { %>'use strict';\n<% } %>" +
|
||||
|
||||
// the `iteratee` may be reassigned by the `top` snippet
|
||||
'var index, iteratee = <%= firstArg %>, ' +
|
||||
// assign the `result` variable an initial value
|
||||
|
||||
Reference in New Issue
Block a user