mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Fix legacy build.
Former-commit-id: 66bb2736adf06ff03b747369e83c508d90cca60e
This commit is contained in:
45
build.js
45
build.js
@@ -3512,30 +3512,9 @@
|
|||||||
if (isTemplate) {
|
if (isTemplate) {
|
||||||
source = buildTemplate(templatePattern, templateSettings);
|
source = buildTemplate(templatePattern, templateSettings);
|
||||||
}
|
}
|
||||||
else if (isModern || isUnderscore) {
|
else {
|
||||||
source = removeFromCreateIterator(source, 'support');
|
source = removeFromCreateIterator(source, 'support');
|
||||||
|
|
||||||
iteratorOptions.forEach(function(prop) {
|
|
||||||
if (prop != 'array') {
|
|
||||||
source = removeFromGetObject(source, prop);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// inline all functions defined with `createIterator`
|
|
||||||
_.functions(lodash).forEach(function(funcName) {
|
|
||||||
if (!(isUnderscore && isLodashFunc(funcName))) {
|
|
||||||
// strip leading underscores to match pseudo private functions
|
|
||||||
var reFunc = RegExp('^( *)(var ' + funcName.replace(/^_/, '') + ' *= *)createIterator\\(((?:{|[a-zA-Z])[\\s\\S]+?)\\);\\n', 'm');
|
|
||||||
if (reFunc.test(source)) {
|
|
||||||
// extract, format, and inject the compiled function's source code
|
|
||||||
source = source.replace(reFunc, function(match, indent, left) {
|
|
||||||
return (indent + left) +
|
|
||||||
cleanupCompiled(getFunctionSource(lodash[funcName], indent)) + ';\n';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// inline `iteratorTemplate` template
|
// inline `iteratorTemplate` template
|
||||||
source = replaceFunction(source, 'iteratorTemplate', (function() {
|
source = replaceFunction(source, 'iteratorTemplate', (function() {
|
||||||
var snippet = cleanupCompiled(getFunctionSource(lodash._iteratorTemplate));
|
var snippet = cleanupCompiled(getFunctionSource(lodash._iteratorTemplate));
|
||||||
@@ -3581,6 +3560,28 @@
|
|||||||
.replace(/iteratorTemplate *&& */g, '')
|
.replace(/iteratorTemplate *&& */g, '')
|
||||||
.replace(/iteratorTemplate\s*\?\s*([^:]+?)\s*:[^,;]+/g, '$1');
|
.replace(/iteratorTemplate\s*\?\s*([^:]+?)\s*:[^,;]+/g, '$1');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
if (isModern || isUnderscore) {
|
||||||
|
iteratorOptions.forEach(function(prop) {
|
||||||
|
if (prop != 'array') {
|
||||||
|
source = removeFromGetObject(source, prop);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// inline all functions defined with `createIterator`
|
||||||
|
_.functions(lodash).forEach(function(funcName) {
|
||||||
|
if (!(isUnderscore && isLodashFunc(funcName))) {
|
||||||
|
// strip leading underscores to match pseudo private functions
|
||||||
|
var reFunc = RegExp('^( *)(var ' + funcName.replace(/^_/, '') + ' *= *)createIterator\\(((?:{|[a-zA-Z])[\\s\\S]+?)\\);\\n', 'm');
|
||||||
|
if (reFunc.test(source)) {
|
||||||
|
// extract, format, and inject the compiled function's source code
|
||||||
|
source = source.replace(reFunc, function(match, indent, left) {
|
||||||
|
return (indent + left) +
|
||||||
|
cleanupCompiled(getFunctionSource(lodash[funcName], indent)) + ';\n';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (isUnderscore) {
|
if (isUnderscore) {
|
||||||
// unexpose "exit early" feature of `basicEach`, `_.forEach`, `_.forIn`, and `_.forOwn`
|
// unexpose "exit early" feature of `basicEach`, `_.forEach`, `_.forIn`, and `_.forOwn`
|
||||||
|
|||||||
Reference in New Issue
Block a user