1 var arrayFilter = require('./_arrayFilter'),
2 arrayMap = require('./_arrayMap'),
3 baseProperty = require('./_baseProperty'),
4 baseTimes = require('./_baseTimes'),
5 isArrayLikeObject = require('./isArrayLikeObject');
7 /* Built-in method references for those with the same name as other `lodash` methods. */
8 var nativeMax = Math.max;
11 * This method is like `_.zip` except that it accepts an array of grouped
12 * elements and creates an array regrouping the elements to their pre-zip
19 * @param {Array} array The array of grouped elements to process.
20 * @returns {Array} Returns the new array of regrouped elements.
23 * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
24 * // => [['a', 1, true], ['b', 2, false]]
27 * // => [['a', 'b'], [1, 2], [true, false]]
29 function unzip(array) {
30 if (!(array && array.length)) {
34 array = arrayFilter(array, function(group) {
35 if (isArrayLikeObject(group)) {
36 length = nativeMax(group.length, length);
40 return baseTimes(length, function(index) {
41 return arrayMap(array, baseProperty(index));
45 module.exports = unzip;