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,5 @@
function _iterableToArray(iter) {
if (typeof iter === 'string' || Object.prototype.toString.call(iter) === "[object Arguments]" || Symbol.iterator in Object(iter)) return Array.from(iter);
if (typeof iter === 'string' || Object.prototype.toString.call(iter) === "[object Arguments]" || typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
}
module.exports = _iterableToArray;