You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
635 B
14 lines
635 B
3 years ago
|
var call = require('../internals/function-call');
|
||
|
var AsyncFromSyncIterator = require('../internals/async-from-sync-iterator');
|
||
|
var anObject = require('../internals/an-object');
|
||
|
var getIterator = require('../internals/get-iterator');
|
||
|
var getMethod = require('../internals/get-method');
|
||
|
var wellKnownSymbol = require('../internals/well-known-symbol');
|
||
|
|
||
|
var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator');
|
||
|
|
||
|
module.exports = function (it, usingIterator) {
|
||
|
var method = arguments.length < 2 ? getMethod(it, ASYNC_ITERATOR) : usingIterator;
|
||
|
return method ? anObject(call(method, it)) : new AsyncFromSyncIterator(getIterator(it));
|
||
|
};
|