UNPKG

768 BJavaScriptView Raw
1import unsupportedIterableToArray from "./unsupportedIterableToArray.js";
2export 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
6 if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
7 if (it) o = it;
8 var i = 0;
9 return function () {
10 if (i >= o.length) return {
11 done: true
12 };
13 return {
14 done: false,
15 value: o[i++]
16 };
17 };
18 }
19
20 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
21}
\No newline at end of file