createForOfIteratorHelperLoose.js 768 B

123456789101112131415161718192021
  1. import unsupportedIterableToArray from "./unsupportedIterableToArray.js";
  2. export default function _createForOfIteratorHelperLoose(o, allowArrayLike) {
  3. var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
  4. if (it) return (it = it.call(o)).next.bind(it);
  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. }