diff options
Diffstat (limited to 'node_modules/babel-runtime/helpers/slicedToArrayLoose.js')
-rw-r--r-- | node_modules/babel-runtime/helpers/slicedToArrayLoose.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/node_modules/babel-runtime/helpers/slicedToArrayLoose.js b/node_modules/babel-runtime/helpers/slicedToArrayLoose.js new file mode 100644 index 000000000..012bbd859 --- /dev/null +++ b/node_modules/babel-runtime/helpers/slicedToArrayLoose.js @@ -0,0 +1,31 @@ +"use strict"; + +exports.__esModule = true; + +var _getIterator2 = require("../core-js/get-iterator"); + +var _getIterator3 = _interopRequireDefault(_getIterator2); + +var _isIterable2 = require("../core-js/is-iterable"); + +var _isIterable3 = _interopRequireDefault(_isIterable2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = function (arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if ((0, _isIterable3.default)(Object(arr))) { + var _arr = []; + + for (var _iterator = (0, _getIterator3.default)(arr), _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"); + } +};
\ No newline at end of file |