Fix legacy build.

Former-commit-id: 66bb2736adf06ff03b747369e83c508d90cca60e
This commit is contained in:
John-David Dalton
2013-06-30 14:31:27 -07:00
parent 6d79ab2552
commit 28e2dee605

View File

@@ -3512,30 +3512,9 @@
if (isTemplate) {
source = buildTemplate(templatePattern, templateSettings);
}
else if (isModern || isUnderscore) {
else {
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
source = replaceFunction(source, 'iteratorTemplate', (function() {
var snippet = cleanupCompiled(getFunctionSource(lodash._iteratorTemplate));
@@ -3581,6 +3560,28 @@
.replace(/iteratorTemplate *&& */g, '')
.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) {
// unexpose "exit early" feature of `basicEach`, `_.forEach`, `_.forIn`, and `_.forOwn`