Skip to content

Commit

Permalink
fix(spread): do not require Symbol
Browse files Browse the repository at this point in the history
fixes #9277
  • Loading branch information
clshortfuse committed Mar 30, 2019
1 parent 1f5444e commit cc952fe
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/babel-helpers/src/helpers.js
Expand Up @@ -861,7 +861,7 @@ 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) ||
(typeof Symbol === 'function' && Symbol.iterator in Object(iter)) ||
Object.prototype.toString.call(iter) === "[object Arguments]"
) return Array.from(iter);
}
Expand Down
@@ -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 (_isIterable(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return _Array$from(iter);
if (typeof _Symbol === 'function' && _isIterable(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return _Array$from(iter);
}
4 changes: 3 additions & 1 deletion packages/babel-runtime-corejs2/helpers/iterableToArray.js
Expand Up @@ -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 (_isIterable(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return _Array$from(iter);
if (typeof _Symbol === 'function' && _isIterable(Object(iter)) || Object.prototype.toString.call(iter) === "[object Arguments]") return _Array$from(iter);
}

module.exports = _iterableToArray;
2 changes: 1 addition & 1 deletion packages/babel-runtime/helpers/esm/iterableToArray.js
@@ -1,3 +1,3 @@
export default function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
if (typeof Symbol === 'function' && Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}
2 changes: 1 addition & 1 deletion packages/babel-runtime/helpers/iterableToArray.js
@@ -1,5 +1,5 @@
function _iterableToArray(iter) {
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
if (typeof Symbol === 'function' && Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}

module.exports = _iterableToArray;

0 comments on commit cc952fe

Please sign in to comment.