Throw better errors for non-iterables when Symbol doesn't exist (#11264)

This commit is contained in:
Nicolò Ribaudo
2020-03-16 16:34:33 +01:00
committed by GitHub
parent 10058901d0
commit 1ba41f2084
17 changed files with 115 additions and 26 deletions

View File

@@ -1,5 +1,6 @@
import _Array$from from "../../core-js/array/from";
import _isIterable from "../../core-js/is-iterable";
import _Symbol from "../../core-js/symbol";
export default function _iterableToArray(iter) {
if (typeof iter === 'string' || Object.prototype.toString.call(iter) === "[object Arguments]" || _isIterable(Object(iter))) return _Array$from(iter);
if (typeof iter === 'string' || Object.prototype.toString.call(iter) === "[object Arguments]" || typeof _Symbol !== "undefined" && _isIterable(Object(iter))) return _Array$from(iter);
}

View File

@@ -2,8 +2,10 @@ var _Array$from = require("../core-js/array/from");
var _isIterable = require("../core-js/is-iterable");
var _Symbol = require("../core-js/symbol");
function _iterableToArray(iter) {
if (typeof iter === 'string' || Object.prototype.toString.call(iter) === "[object Arguments]" || _isIterable(Object(iter))) return _Array$from(iter);
if (typeof iter === 'string' || Object.prototype.toString.call(iter) === "[object Arguments]" || typeof _Symbol !== "undefined" && _isIterable(Object(iter))) return _Array$from(iter);
}
module.exports = _iterableToArray;