fix(rest-spread): Do not require Symbol.iterator for strings (#9794)

This commit is contained in:
Carlos Lopez
2020-03-15 09:54:44 -04:00
committed by GitHub
parent 661ffbd830
commit 7b9bc7c28b
8 changed files with 22 additions and 6 deletions

View File

@@ -934,8 +934,9 @@ helpers.arrayWithHoles = helper("7.0.0-beta.0")`
helpers.iterableToArray = helper("7.0.0-beta.0")`
export default function _iterableToArray(iter) {
if (
Symbol.iterator in Object(iter) ||
Object.prototype.toString.call(iter) === "[object Arguments]"
typeof iter === 'string'
|| Object.prototype.toString.call(iter) === "[object Arguments]"
|| Symbol.iterator in Object(iter)
) return Array.from(iter);
}
`;