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.
16 lines
691 B
16 lines
691 B
1 month ago
|
'use strict';
|
||
|
var $ = require('../internals/export');
|
||
|
var anObject = require('../internals/an-object');
|
||
|
var AsyncFromSyncIterator = require('../internals/async-from-sync-iterator');
|
||
|
var WrapAsyncIterator = require('../internals/async-iterator-wrap');
|
||
|
var getIteratorDirect = require('../internals/get-iterator-direct');
|
||
|
var IS_PURE = require('../internals/is-pure');
|
||
|
|
||
|
// `Iterator.prototype.toAsync` method
|
||
|
// https://github.com/tc39/proposal-async-iterator-helpers
|
||
|
$({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
|
||
|
toAsync: function toAsync() {
|
||
|
return new WrapAsyncIterator(getIteratorDirect(new AsyncFromSyncIterator(getIteratorDirect(anObject(this)))));
|
||
|
}
|
||
|
});
|