Simplify _.zip for the underscore build.

Former-commit-id: 18560e78f052fad5c5d7af1ef6571dd31accf690
This commit is contained in:
John-David Dalton
2013-07-08 08:29:18 -07:00
parent ee01c944b4
commit 36488fd836
5 changed files with 26 additions and 7 deletions

View File

@@ -3598,6 +3598,21 @@
'}'
].join('\n'));
}
// replace `_.zip`
if(!isLodashFunc('zip')) {
source = replaceFunction(source, 'zip', [
'function zip() {',
' var index = -1,',
" length = max(pluck(arguments, 'length')),",
' result = Array(length < 0 ? 0 : length);',
'',
' while (++index < length) {',
' result[index] = pluck(arguments, index);',
' }',
' return result;',
'}'
].join('\n'));
}
// unexpose `lodash.support`
if (!isLodashFunc('support')) {
source = source.replace(/\blodash\.support *= */, '');