We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8c1d27 commit d6f7058Copy full SHA for d6f7058
src/underbar.js
@@ -633,13 +633,17 @@ var _ = {};
633
_.zip = function() {
634
var results=[];
635
var args=Array.prototype.slice.call(arguments);
636
+ var max=0;
637
_.each(args, function(arr) {
- _.each(arr, function(val, index) {
638
- if (results[index]===undefined) {
+ arr.length > max ? max=arr.length : null;
639
+ });
640
+ _.each(args, function(arr) {
641
+ for (var i=0; i<max; i++) {
642
+ if (results[i]===undefined) {
643
results.push([]);
644
}
- results[index].push(val);
- });
645
+ results[i].push(arr[i]);
646
+ }
647
});
648
649
return results;
0 commit comments