bd0dbb8468a5f2c16fa8a525451dd7d7142fb2fb
[platform/framework/web/crosswalk-tizen.git] /
1 define(['./max', './map'], function (max, map) {
2
3     function getLength(arr) {
4         return arr == null ? 0 : arr.length;
5     }
6
7     /**
8      * Merges together the values of each of the arrays with the values at the
9      * corresponding position.
10      */
11     function zip(arr){
12         var len = arr ? max(map(arguments, getLength)) : 0,
13             results = [],
14             i = -1;
15         while (++i < len) {
16             // jshint loopfunc: true
17             results.push(map(arguments, function(item) {
18                 return item == null ? undefined : item[i];
19             }));
20         }
21
22         return results;
23     }
24
25     return zip;
26
27 });