Cleanup build tests and inline _.mixin when it's removed to preserve chaining behavior.

Former-commit-id: ed24a9acfabb70fb7093479a5c3484d966cbc5bb
This commit is contained in:
John-David Dalton
2013-02-24 03:04:39 -08:00
parent 8e30fe2946
commit fc6568f390
2 changed files with 30 additions and 29 deletions

View File

@@ -2417,8 +2417,21 @@
if (isRemoved(source, 'isFunction')) {
source = removeIsFunctionFallback(source);
}
if (isRemoved(source, 'mixin') || isRemoved(source, 'value')) {
source = source.replace(/(?:\s*\/\/.*)*\s*mixin\(lodash\).+/, '');
if (isRemoved(source, 'mixin')) {
// inline `_.mixin` call to ensure proper chaining behavior
source = source.replace(/^( *)mixin\(lodash\).+/m, function(match, indent) {
return indent + [
'forOwn(lodash, function(func, methodName) {',
' lodash[methodName] = func;',
'',
' lodash.prototype[methodName] = function() {',
' var args = [this.__wrapped__];',
' push.apply(args, arguments);',
' return new lodash(func.apply(lodash, args));',
' };',
'});'
].join('\n' + indent);
});
}
if (isRemoved(source, 'value')) {
source = removeHasObjectSpliceBug(source);