mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11:27:50 +00:00
Remove the binding optimization from all but the modern build.
Former-commit-id: 1023ccc976e180425dabaa1b61e873e542aa3c2a
This commit is contained in:
25
build.js
25
build.js
@@ -1095,6 +1095,26 @@
|
||||
return source.replace(getCreateObjectFallback(source), '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the binding optimization from `source`.
|
||||
*
|
||||
* @private
|
||||
* @param {String} source The source to process.
|
||||
* @returns {String} Returns the modified source.
|
||||
*/
|
||||
function removeBindingOptimization(source) {
|
||||
source = removeVar(source, 'fnToString');
|
||||
source = removeVar(source, 'reThis');
|
||||
|
||||
// remove `reThis` from `createCallback`
|
||||
source = source.replace(matchFunction(source, 'createCallback'), function(match) {
|
||||
return match.replace(/\s*\|\|\s*\(reThis[\s\S]+?\)\)\)/, '');
|
||||
});
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the `Object.keys` object iteration optimization from `source`.
|
||||
*
|
||||
@@ -1270,7 +1290,7 @@
|
||||
// remove `support.nonEnumArgs` from `_.keys`
|
||||
source = source.replace(matchFunction(source, 'keys'), function(match) {
|
||||
return match
|
||||
.replace(/(?:\s*\|\|\s*)?\(support\.nonEnumArgs[^)]+\)\)/, '')
|
||||
.replace(/(?:\s*\|\|\s*)?\(support\.nonEnumArgs[\s\S]+?\)\)/, '')
|
||||
.replace(/\s*if *\(\s*\)[^}]+}/, '');
|
||||
});
|
||||
|
||||
@@ -2044,6 +2064,9 @@
|
||||
].join('\n'));
|
||||
}
|
||||
}
|
||||
if (isLegacy || isMobile || isUnderscore) {
|
||||
source = removeBindingOptimization(source);
|
||||
}
|
||||
if (isMobile || isUnderscore) {
|
||||
source = removeKeysOptimization(source);
|
||||
source = removeSetImmediate(source);
|
||||
|
||||
Reference in New Issue
Block a user