createForOfIteratorHelperLoose.js 840 B

12345678910111213141516171819202122232425262728
  1. var unsupportedIterableToArray = require("./unsupportedIterableToArray");
  2. function _createForOfIteratorHelperLoose(o, allowArrayLike) {
  3. var it;
  4. if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
  5. if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  6. if (it) o = it;
  7. var i = 0;
  8. return function () {
  9. if (i >= o.length) return {
  10. done: true
  11. };
  12. return {
  13. done: false,
  14. value: o[i++]
  15. };
  16. };
  17. }
  18. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  19. }
  20. it = o[Symbol.iterator]();
  21. return it.next.bind(it);
  22. }
  23. module.exports = _createForOfIteratorHelperLoose;