docs: function collect(iterator) {
      var result = [];
  
      for (;;) {
          var item = iterator.next();
          if (item.done) {
              break;
          }
          result.push(item.value);
      }
  
      return result;
  }