slicedToArrayLoose.js 823 B

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. exports.__esModule = true;
  3. var _getIterator2 = require("../core-js/get-iterator");
  4. var _getIterator3 = _interopRequireDefault(_getIterator2);
  5. var _isIterable2 = require("../core-js/is-iterable");
  6. var _isIterable3 = _interopRequireDefault(_isIterable2);
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. exports.default = function (arr, i) {
  9. if (Array.isArray(arr)) {
  10. return arr;
  11. } else if ((0, _isIterable3.default)(Object(arr))) {
  12. var _arr = [];
  13. for (var _iterator = (0, _getIterator3.default)(arr), _step; !(_step = _iterator.next()).done;) {
  14. _arr.push(_step.value);
  15. if (i && _arr.length === i) break;
  16. }
  17. return _arr;
  18. } else {
  19. throw new TypeError("Invalid attempt to destructure non-iterable instance");
  20. }
  21. };