You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
342 B

4 years ago
  1. 'use strict';
  2. module.exports = function zip(array) {
  3. var _this = this;
  4. var values = array;
  5. if (values instanceof this.constructor) {
  6. values = values.all();
  7. }
  8. var collection = this.items.map(function (item, index) {
  9. return new _this.constructor([item, values[index]]);
  10. });
  11. return new this.constructor(collection);
  12. };