1 var arrayFilter = require('./internal/arrayFilter'),
2 arrayMap = require('./internal/arrayMap'),
3 baseProperty = require('./internal/baseProperty'),
4 baseTimes = require('./internal/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
18 * @param {Array} array The array of grouped elements to process.
19 * @returns {Array} Returns the new array of regrouped elements.
22 * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
23 * // => [['fred', 30, true], ['barney', 40, false]]
26 * // => [['fred', 'barney'], [30, 40], [true, false]]
28 function unzip(array) {
29 if (!(array && array.length)) {
33 array = arrayFilter(array, function(group) {
34 if (isArrayLikeObject(group)) {
35 length = nativeMax(group.length, length);
39 return baseTimes(length, function(index) {
40 return arrayMap(array, baseProperty(index));
44 module.exports = unzip;