zip.js 625 B

123456789101112131415161718192021
  1. var restParam = require('../function/restParam'),
  2. unzip = require('./unzip');
  3. /**
  4. * Creates an array of grouped elements, the first of which contains the first
  5. * elements of the given arrays, the second of which contains the second elements
  6. * of the given arrays, and so on.
  7. *
  8. * @static
  9. * @memberOf _
  10. * @category Array
  11. * @param {...Array} [arrays] The arrays to process.
  12. * @returns {Array} Returns the new array of grouped elements.
  13. * @example
  14. *
  15. * _.zip(['fred', 'barney'], [30, 40], [true, false]);
  16. * // => [['fred', 30, true], ['barney', 40, false]]
  17. */
  18. var zip = restParam(unzip);
  19. module.exports = zip;