1
|
"use strict";
|
2
|
|
3
|
exports.__esModule = true;
|
4
|
|
5
|
var _isIterable2 = require("../core-js/is-iterable");
|
6
|
|
7
|
var _isIterable3 = _interopRequireDefault(_isIterable2);
|
8
|
|
9
|
var _getIterator2 = require("../core-js/get-iterator");
|
10
|
|
11
|
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
12
|
|
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
|
15
|
exports.default = function () {
|
16
|
function sliceIterator(arr, i) {
|
17
|
var _arr = [];
|
18
|
var _n = true;
|
19
|
var _d = false;
|
20
|
var _e = undefined;
|
21
|
|
22
|
try {
|
23
|
for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
24
|
_arr.push(_s.value);
|
25
|
|
26
|
if (i && _arr.length === i) break;
|
27
|
}
|
28
|
} catch (err) {
|
29
|
_d = true;
|
30
|
_e = err;
|
31
|
} finally {
|
32
|
try {
|
33
|
if (!_n && _i["return"]) _i["return"]();
|
34
|
} finally {
|
35
|
if (_d) throw _e;
|
36
|
}
|
37
|
}
|
38
|
|
39
|
return _arr;
|
40
|
}
|
41
|
|
42
|
return function (arr, i) {
|
43
|
if (Array.isArray(arr)) {
|
44
|
return arr;
|
45
|
} else if ((0, _isIterable3.default)(Object(arr))) {
|
46
|
return sliceIterator(arr, i);
|
47
|
} else {
|
48
|
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
49
|
}
|
50
|
};
|
51
|
}();
|