Allow argCount to be omitted an not default to 3, and cleanup createBound.

Former-commit-id: cbafeaa441aae1ef28268bc2614b1a6e038acfe1
This commit is contained in:
John-David Dalton
2013-07-22 19:11:44 -07:00
parent 2c772d0f4c
commit 17e32017a7
8 changed files with 272 additions and 277 deletions

View File

@@ -1639,10 +1639,9 @@
// remove `__bindData__` logic and `setBindData` function calls from `createBound`
source = source.replace(matchFunction(source, 'createBound'), function(match) {
return match
.replace(/\bargs *=.+?__bindData__.+\s+/, '')
.replace(/(?:\s*\/\/.*)*\n( *)if *\(args\)[\s\S]+?\n\1}/m, '')
.replace(/(?:\s*\/\/.*)*\n( *)var args *=[\s\S]+?\n\1}/, '')
.replace(/(?:\s*\/\/.*)*\n.+args *= *nativeSlice.+/, '')
.replace(/(?:\s*\/\/.*)*\n.+?setBindData.+/m, '')
.replace(/(?:\s*\/\/.*)*\n.+?setBindData.+/, '')
});
@@ -3060,7 +3059,7 @@
' var index = -1,',
' length = collection ? collection.length : 0;',
'',
" callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg);",
" callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg, 3);",
" if (typeof length == 'number') {",
' while (++index < length) {',
' if (callback(collection[index], index, collection) === false) {',
@@ -3089,7 +3088,7 @@
' var index = -1,',
' length = collection ? collection.length : 0;',
'',
' callback = lodash.createCallback(callback, thisArg);',
' callback = lodash.createCallback(callback, thisArg, 3);',
" if (typeof length == 'number') {",
' var result = Array(length);',
' while (++index < length) {',
@@ -3518,7 +3517,7 @@
' length = collection ? collection.length : 0,',
" result = Array(typeof length == 'number' ? length : 0);",
'',
' callback = lodash.createCallback(callback, thisArg);',
' callback = lodash.createCallback(callback, thisArg, 3);',
' forEach(collection, function(value, key, collection) {',
' result[++index] = {',
" 'criteria': callback(value, key, collection),",