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

@@ -3214,13 +3214,12 @@
* // => [['moe', 30, true], ['larry', 40, false]]
*/
function zip() {
var array = arguments.length > 1 ? arguments : arguments[0],
index = -1,
length = array ? max(pluck(array, 'length')) : 0,
var index = -1,
length = max(pluck(arguments, 'length')),
result = Array(length < 0 ? 0 : length);
while (++index < length) {
result[index] = pluck(array, index);
result[index] = pluck(arguments, index);
}
return result;
}