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