diff --git a/packages/core-js/internals/get-async-iterator.js b/packages/core-js/internals/get-async-iterator.js index d8b498c7312c..f5118bdf5533 100644 --- a/packages/core-js/internals/get-async-iterator.js +++ b/packages/core-js/internals/get-async-iterator.js @@ -7,8 +7,8 @@ var wellKnownSymbol = require('../internals/well-known-symbol'); var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator'); -module.exports = function (it) { - var method = getMethod(it[ASYNC_ITERATOR]); +module.exports = function (it, usingIterator) { + var method = arguments.length < 2 ? getMethod(it[ASYNC_ITERATOR]) : usingIterator; if (method === undefined) { return new AsyncFromSyncIterator(getIterator(it)); } return anObject(aFunction(method).call(it)); diff --git a/packages/core-js/internals/get-iterator.js b/packages/core-js/internals/get-iterator.js index f7f7f8ef3b60..73d31345b60b 100644 --- a/packages/core-js/internals/get-iterator.js +++ b/packages/core-js/internals/get-iterator.js @@ -1,8 +1,8 @@ var anObject = require('../internals/an-object'); var getIteratorMethod = require('../internals/get-iterator-method'); -module.exports = function (it) { - var iteratorMethod = getIteratorMethod(it); +module.exports = function (it, usingIterator) { + var iteratorMethod = arguments.length < 2 ? getIteratorMethod(it) : usingIterator; if (typeof iteratorMethod != 'function') { throw TypeError(String(it) + ' is not iterable'); } return anObject(iteratorMethod.call(it)); diff --git a/packages/core-js/modules/esnext.async-iterator.from.js b/packages/core-js/modules/esnext.async-iterator.from.js index 9f1e40360223..2f12625b69ac 100644 --- a/packages/core-js/modules/esnext.async-iterator.from.js +++ b/packages/core-js/modules/esnext.async-iterator.from.js @@ -1,11 +1,11 @@ // https://github.com/tc39/proposal-iterator-helpers var $ = require('../internals/export'); var path = require('../internals/path'); -var aFunction = require('../internals/a-function'); var anObject = require('../internals/an-object'); var toObject = require('../internals/to-object'); var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy'); var getAsyncIterator = require('../internals/get-async-iterator'); +var getIterator = require('../internals/get-iterator'); var getIteratorMethod = require('../internals/get-iterator-method'); var getMethod = require('../internals/get-method'); var wellKnownSymbol = require('../internals/well-known-symbol'); @@ -25,12 +25,12 @@ $({ target: 'AsyncIterator', stat: true }, { var usingIterator = getMethod(object[ASYNC_ITERATOR]); var iterator; if (usingIterator !== undefined) { - iterator = getAsyncIterator(object); + iterator = getAsyncIterator(object, usingIterator); if (iterator instanceof AsyncIterator) return iterator; } if (iterator === undefined) { usingIterator = getIteratorMethod(object); - if (usingIterator !== undefined) return new AsyncFromSyncIterator(aFunction(usingIterator).call(object)); + if (usingIterator !== undefined) return new AsyncFromSyncIterator(getIterator(object, usingIterator)); } return new AsyncIteratorProxy({ iterator: iterator !== undefined ? iterator : object