mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
Cleanup iteratorTemplate and remove more code from the "underscore" build.
Former-commit-id: 3f4c283f0aa205dbcce1940f7222b594284263c4
This commit is contained in:
17
build.js
17
build.js
@@ -23,8 +23,11 @@
|
||||
/** Flag used to specify a legacy build */
|
||||
var isLegacy = process.argv.indexOf('legacy') > -1;
|
||||
|
||||
/** Flag used to specify an Underscore build */
|
||||
var isUnderscore = process.argv.indexOf('underscore') > -1;
|
||||
|
||||
/** Flag used to specify a mobile build */
|
||||
var isMobile = !isLegacy && (isCSP || process.argv.indexOf('mobile') > -1);
|
||||
var isMobile = !isLegacy && (isCSP || isUnderscore || process.argv.indexOf('mobile') > -1);
|
||||
|
||||
/**
|
||||
* Flag used to specify `_.bindAll`, `_.extend`, and `_.defaults` are
|
||||
@@ -32,9 +35,6 @@
|
||||
*/
|
||||
var isStrict = process.argv.indexOf('strict') > -1;
|
||||
|
||||
/** Flag used to specify an Underscore build */
|
||||
var isUnderscore = process.argv.indexOf('underscore') > -1;
|
||||
|
||||
/** Flag used to specify if the build should include the "use strict" directive */
|
||||
var useStrict = isStrict || !(isLegacy || isMobile);
|
||||
|
||||
@@ -56,14 +56,19 @@
|
||||
source = setUseStrictOption(source, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (isLegacy) {
|
||||
source = replaceVar(source, 'noArgsClass', 'true');
|
||||
['isBindFast', 'isKeysFast', 'isStrictFast', 'nativeBind', 'nativeIsArray', 'nativeKeys'].forEach(function(varName) {
|
||||
source = replaceVar(source, varName, 'false');
|
||||
});
|
||||
}
|
||||
else if (isMobile) {
|
||||
else if (isUnderscore) {
|
||||
// remove `prototype` [[Enumerable]] fix from `iteratorTemplate`
|
||||
source = source
|
||||
.replace(/(?: *\/\/.*\n)*\s*' *(?:<% *)?if *\(!hasDontEnumBug *(?:&&|\))[\s\S]+?<% *} *(?:%>|').+/g, '')
|
||||
.replace(/!hasDontEnumBug *\|\|/g, '');
|
||||
}
|
||||
if (isMobile) {
|
||||
source = replaceVar(source, 'isKeysFast', 'false');
|
||||
}
|
||||
vm.runInNewContext(source, sandbox);
|
||||
|
||||
Reference in New Issue
Block a user