Fix incorrectly changed methodName vars in build.js.

Former-commit-id: 73ca6e2241cda5051e752b238a74c75d9c2f8409
This commit is contained in:
John-David Dalton
2013-06-30 14:51:57 -07:00
parent 68dc6b9527
commit ae7b9f5fcb

View File

@@ -659,15 +659,15 @@
source = source.replace(/^ *lodash\.prototype\.(?:toString|valueOf) *=.+\n/gm, ''); source = source.replace(/^ *lodash\.prototype\.(?:toString|valueOf) *=.+\n/gm, '');
// remove `lodash.prototype` batch method assignments // remove `lodash.prototype` batch method assignments
source = source.replace(/(?:\s*\/\/.*)*\n( *)forOwn\(lodash, *function\(func, *funcName\)[\s\S]+?\n\1}.+/g, ''); source = source.replace(/(?:\s*\/\/.*)*\n( *)forOwn\(lodash, *function\(func, *methodName\)[\s\S]+?\n\1}.+/g, '');
// replace `_.mixin` // replace `_.mixin`
source = replaceFunction(source, 'mixin', [ source = replaceFunction(source, 'mixin', [
'function mixin(object) {', 'function mixin(object) {',
' forEach(functions(object), function(funcName) {', ' forEach(functions(object), function(methodName) {',
' var func = lodash[funcName] = object[funcName];', ' var func = lodash[methodName] = object[methodName];',
'', '',
' lodash.prototype[funcName] = function() {', ' lodash.prototype[methodName] = function() {',
' var args = [this.__wrapped__];', ' var args = [this.__wrapped__];',
' push.apply(args, arguments);', ' push.apply(args, arguments);',
'', '',
@@ -683,12 +683,12 @@
].join('\n')); ].join('\n'));
// replace wrapper `Array` method assignments // replace wrapper `Array` method assignments
source = source.replace(/^(?:(?: *\/\/.*\n)*(?: *if *\(.+\n)?( *)(basicEach|forEach)\(\['[\s\S]+?\n\1}\);(?:\n *})?\n+)+/m, function(match, indent, funcName) { source = source.replace(/^(?:(?: *\/\/.*\n)*(?: *if *\(.+\n)?( *)(basicEach|forEach)\(\['[\s\S]+?\n\1}\);(?:\n *})?\n+)+/m, function(match, indent, methodName) {
return indent + [ return indent + [
'// add `Array` mutator functions to the wrapper', '// add `Array` mutator functions to the wrapper',
funcName + "(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(funcName) {", methodName + "(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {",
' var func = arrayRef[funcName];', ' var func = arrayRef[methodName];',
' lodash.prototype[funcName] = function() {', ' lodash.prototype[methodName] = function() {',
' var value = this.__wrapped__;', ' var value = this.__wrapped__;',
' func.apply(value, arguments);', ' func.apply(value, arguments);',
'', '',
@@ -702,9 +702,9 @@
'});', '});',
'', '',
'// add `Array` accessor functions to the wrapper', '// add `Array` accessor functions to the wrapper',
funcName + "(['concat', 'join', 'slice'], function(funcName) {", methodName + "(['concat', 'join', 'slice'], function(methodName) {",
' var func = arrayRef[funcName];', ' var func = arrayRef[methodName];',
' lodash.prototype[funcName] = function() {', ' lodash.prototype[methodName] = function() {',
' var value = this.__wrapped__,', ' var value = this.__wrapped__,',
' result = func.apply(value, arguments);', ' result = func.apply(value, arguments);',
'', '',
@@ -1611,7 +1611,7 @@
* *
* @private * @private
* @param {String} source The source to process. * @param {String} source The source to process.
* @param {String} [funcName] The name of the property to remove. * @param {String} [propName] The name of the property to remove.
* @returns {String} Returns the modified source. * @returns {String} Returns the modified source.
*/ */
function removePseudoPrivates(source, propName) { function removePseudoPrivates(source, propName) {
@@ -3712,10 +3712,10 @@
return ''; return '';
} }
return prelude + indent + [ return prelude + indent + [
'forOwn(lodash, function(func, funcName) {', 'forOwn(lodash, function(func, methodName) {',
' lodash[funcName] = func;', ' lodash[methodName] = func;',
'', '',
' lodash.prototype[funcName] = function() {', ' lodash.prototype[methodName] = function() {',
' var value = this.__wrapped__,', ' var value = this.__wrapped__,',
' args = [value];', ' args = [value];',
'', '',
@@ -3746,8 +3746,8 @@
// remove `lodash.prototype` method assignments from `_.mixin` // remove `lodash.prototype` method assignments from `_.mixin`
source = replaceFunction(source, 'mixin', [ source = replaceFunction(source, 'mixin', [
'function mixin(object) {', 'function mixin(object) {',
' forEach(functions(object), function(funcName) {', ' forEach(functions(object), function(methodName) {',
' lodash[funcName] = object[funcName];', ' lodash[methodName] = object[methodName];',
' });', ' });',
'}' '}'
].join('\n')); ].join('\n'));