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.
parttimejob/node_modules/core-js/internals/get-async-iterator-flattena...

31 lines
1.1 KiB

1 month ago
'use strict';
var call = require('../internals/function-call');
var isCallable = require('../internals/is-callable');
var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var getIteratorMethod = require('../internals/get-iterator-method');
var getMethod = require('../internals/get-method');
var wellKnownSymbol = require('../internals/well-known-symbol');
var AsyncFromSyncIterator = require('../internals/async-from-sync-iterator');
var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator');
module.exports = function (obj) {
var object = anObject(obj);
var alreadyAsync = true;
var method = getMethod(object, ASYNC_ITERATOR);
var iterator;
if (!isCallable(method)) {
method = getIteratorMethod(object);
alreadyAsync = false;
}
if (method !== undefined) {
iterator = call(method, object);
} else {
iterator = object;
alreadyAsync = true;
}
anObject(iterator);
return getIteratorDirect(alreadyAsync ? iterator : new AsyncFromSyncIterator(getIteratorDirect(iterator)));
};