toConsumableArray.js 466 B

123456789101112131415161718192021
  1. "use strict";
  2. exports.__esModule = true;
  3. var _from = require("../core-js/array/from");
  4. var _from2 = _interopRequireDefault(_from);
  5. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6. exports.default = function (arr) {
  7. if (Array.isArray(arr)) {
  8. for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
  9. arr2[i] = arr[i];
  10. }
  11. return arr2;
  12. } else {
  13. return (0, _from2.default)(arr);
  14. }
  15. };