mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
more work
This commit is contained in:
35
node_modules/lodash/array/unzip.js
generated
vendored
Normal file
35
node_modules/lodash/array/unzip.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
var arrayMap = require('../internal/arrayMap'),
|
||||
arrayMax = require('../internal/arrayMax'),
|
||||
baseProperty = require('../internal/baseProperty'),
|
||||
getLength = require('../internal/getLength');
|
||||
|
||||
/**
|
||||
* This method is like `_.zip` except that it accepts an array of grouped
|
||||
* elements and creates an array regrouping the elements to their pre-`_.zip`
|
||||
* configuration.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @category Array
|
||||
* @param {Array} array The array of grouped elements to process.
|
||||
* @returns {Array} Returns the new array of regrouped elements.
|
||||
* @example
|
||||
*
|
||||
* var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);
|
||||
* // => [['fred', 30, true], ['barney', 40, false]]
|
||||
*
|
||||
* _.unzip(zipped);
|
||||
* // => [['fred', 'barney'], [30, 40], [true, false]]
|
||||
*/
|
||||
function unzip(array) {
|
||||
var index = -1,
|
||||
length = (array && array.length && arrayMax(arrayMap(array, getLength))) >>> 0,
|
||||
result = Array(length);
|
||||
|
||||
while (++index < length) {
|
||||
result[index] = arrayMap(array, baseProperty(index));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = unzip;
|
Reference in New Issue
Block a user