iwmlib/lib/3rdparty/systemjs/babel-helpers/slicedToArrayLoose.js

17 lines
435 B
JavaScript
Raw Normal View History

2019-04-05 10:09:27 +02:00
export default (function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
var _arr = [];
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
_arr.push(_step.value);
if (i && _arr.length === i) break;
}
return _arr;
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
});