35c78becf42b6c73f74edf63dffb2411add92fe0f9fd14181f20ef96f477c02b65d8fb337298efc8c4946c5a60dfb6cc0d0e0b023ff0407ef0851523e2a46f 360 B

123456789101112131415161718
  1. /**
  2. * Converts `iterator` to an array.
  3. *
  4. * @private
  5. * @param {Object} iterator The iterator to convert.
  6. * @returns {Array} Returns the converted array.
  7. */
  8. function iteratorToArray(iterator) {
  9. var data,
  10. result = [];
  11. while (!(data = iterator.next()).done) {
  12. result.push(data.value);
  13. }
  14. return result;
  15. }
  16. module.exports = iteratorToArray;