Skip to content

Commit

Permalink
Use toString to check if param is a Map or Set
Browse files Browse the repository at this point in the history
  • Loading branch information
sharmilajesupaul committed Nov 2, 2018
1 parent 3ad4dfe commit ca35f9a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/babel-helpers/src/helpers.js
Expand Up @@ -865,8 +865,8 @@ helpers.iterableToArray = helper("7.0.0-beta.0")`
|| typeof iter === 'string'
|| (typeof Symbol === 'function' && Symbol.iterator in Object(iter))
|| (iter && 'length' in iter)
|| (typeof Map !== 'undefined' && iter instanceof Map)
|| (typeof Set !== 'undefined' && iter instanceof Set)
|| Object.prototype.toString.call(iter) === "[object Map]"
|| Object.prototype.toString.call(iter) === "[object Set]"
|| Object.prototype.toString.call(iter) === "[object Arguments]"
) return Array.from(iter);
}
Expand Down
@@ -1,9 +1,7 @@
import _Array$from from "../../core-js/array/from";
import _Set from "../../core-js/set";
import _Map from "../../core-js/map";
import _isIterable from "../../core-js/is-iterable";
import _Symbol from "../../core-js/symbol";
import _Array$isArray from "../../core-js/array/is-array";
export default function _iterableToArray(iter) {
if (_Array$isArray(iter) || typeof iter === 'string' || typeof _Symbol === 'function' && _isIterable(Object(iter)) || iter && 'length' in iter || typeof _Map !== 'undefined' && iter instanceof _Map || typeof _Set !== 'undefined' && iter instanceof _Set || Object.prototype.toString.call(iter) === "[object Arguments]") return _Array$from(iter);
if (_Array$isArray(iter) || typeof iter === 'string' || typeof _Symbol === 'function' && _isIterable(Object(iter)) || iter && 'length' in iter || Object.prototype.toString.call(iter) === "[object Map]" || Object.prototype.toString.call(iter) === "[object Set]" || Object.prototype.toString.call(iter) === "[object Arguments]") return _Array$from(iter);
}
6 changes: 1 addition & 5 deletions packages/babel-runtime-corejs2/helpers/iterableToArray.js
@@ -1,17 +1,13 @@
var _Array$from = require("../core-js/array/from");

var _Set = require("../core-js/set");

var _Map = require("../core-js/map");

var _isIterable = require("../core-js/is-iterable");

var _Symbol = require("../core-js/symbol");

var _Array$isArray = require("../core-js/array/is-array");

function _iterableToArray(iter) {
if (_Array$isArray(iter) || typeof iter === 'string' || typeof _Symbol === 'function' && _isIterable(Object(iter)) || iter && 'length' in iter || typeof _Map !== 'undefined' && iter instanceof _Map || typeof _Set !== 'undefined' && iter instanceof _Set || Object.prototype.toString.call(iter) === "[object Arguments]") return _Array$from(iter);
if (_Array$isArray(iter) || typeof iter === 'string' || typeof _Symbol === 'function' && _isIterable(Object(iter)) || iter && 'length' in iter || Object.prototype.toString.call(iter) === "[object Map]" || Object.prototype.toString.call(iter) === "[object Set]" || 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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/babel-runtime/helpers/iterableToArray.js
@@ -1,5 +1,5 @@
function _iterableToArray(iter) {
if (Array.isArray(iter) || typeof iter === 'string' || typeof Symbol === 'function' && Symbol.iterator in Object(iter) || iter && 'length' in iter || typeof Map !== 'undefined' && iter instanceof Map || typeof Set !== 'undefined' && iter instanceof Set || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
if (Array.isArray(iter) || typeof iter === 'string' || typeof Symbol === 'function' && Symbol.iterator in Object(iter) || iter && 'length' in iter || Object.prototype.toString.call(iter) === "[object Map]" || Object.prototype.toString.call(iter) === "[object Set]" || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}

module.exports = _iterableToArray;

0 comments on commit ca35f9a

Please sign in to comment.