diff --git a/build.js b/build.js index 10d05e891..17c533afd 100755 --- a/build.js +++ b/build.js @@ -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`