createForOfIteratorHelper.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import unsupportedIterableToArray from "./unsupportedIterableToArray.js";
  2. function _createForOfIteratorHelper(r, e) {
  3. var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  4. if (!t) {
  5. if (Array.isArray(r) || (t = unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
  6. t && (r = t);
  7. var _n = 0,
  8. F = function F() {};
  9. return {
  10. s: F,
  11. n: function n() {
  12. return _n >= r.length ? {
  13. done: !0
  14. } : {
  15. done: !1,
  16. value: r[_n++]
  17. };
  18. },
  19. e: function e(r) {
  20. throw r;
  21. },
  22. f: F
  23. };
  24. }
  25. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  26. }
  27. var o,
  28. a = !0,
  29. u = !1;
  30. return {
  31. s: function s() {
  32. t = t.call(r);
  33. },
  34. n: function n() {
  35. var r = t.next();
  36. return a = r.done, r;
  37. },
  38. e: function e(r) {
  39. u = !0, o = r;
  40. },
  41. f: function f() {
  42. try {
  43. a || null == t["return"] || t["return"]();
  44. } finally {
  45. if (u) throw o;
  46. }
  47. }
  48. };
  49. }
  50. export { _createForOfIteratorHelper as default };