UNPKG

1.14 kBJavaScriptView Raw
1import _Symbol from "@babel/runtime-corejs3/core-js/symbol";
2import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
3import _bindInstanceProperty from "@babel/runtime-corejs3/core-js/instance/bind";
4import _Array$isArray from "@babel/runtime-corejs3/core-js/array/is-array";
5import unsupportedIterableToArray from "./unsupportedIterableToArray.js";
6export default function _createForOfIteratorHelperLoose(o, allowArrayLike) {
7 var _context;
8
9 var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"];
10 if (it) return _bindInstanceProperty(_context = (it = it.call(o)).next).call(_context, it);
11
12 if (_Array$isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
13 if (it) o = it;
14 var i = 0;
15 return function () {
16 if (i >= o.length) return {
17 done: true
18 };
19 return {
20 done: false,
21 value: o[i++]
22 };
23 };
24 }
25
26 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
27}
\No newline at end of file