slicedToArrayLoose.js 435 B

1234567891011121314151617
  1. export default (function (arr, i) {
  2. if (Array.isArray(arr)) {
  3. return arr;
  4. } else if (Symbol.iterator in Object(arr)) {
  5. var _arr = [];
  6. for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
  7. _arr.push(_step.value);
  8. if (i && _arr.length === i) break;
  9. }
  10. return _arr;
  11. } else {
  12. throw new TypeError("Invalid attempt to destructure non-iterable instance");
  13. }
  14. });