better slicedToArray helper
This commit is contained in:
parent
ba9b85f64b
commit
c6ce1a248c
@ -1,14 +1,14 @@
|
||||
(function (arr, i) {
|
||||
if (!arr || !arr[Symbol.iterator]) {
|
||||
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
||||
} else if (Array.isArray(arr)) {
|
||||
if (Array.isArray(arr)) {
|
||||
return arr;
|
||||
} else {
|
||||
} else if (Symbol.iterator in 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");
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user