Initial commit
This commit is contained in:
5
node_modules/mongodb/lib/async/.eslintrc
generated
vendored
Normal file
5
node_modules/mongodb/lib/async/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
}
|
||||
}
|
||||
33
node_modules/mongodb/lib/async/async_iterator.js
generated
vendored
Normal file
33
node_modules/mongodb/lib/async/async_iterator.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
// async function* asyncIterator() {
|
||||
// while (true) {
|
||||
// const value = await this.next();
|
||||
// if (!value) {
|
||||
// await this.close();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// yield value;
|
||||
// }
|
||||
// }
|
||||
|
||||
// TODO: change this to the async generator function above
|
||||
function asyncIterator() {
|
||||
const cursor = this;
|
||||
|
||||
return {
|
||||
next: function() {
|
||||
return Promise.resolve()
|
||||
.then(() => cursor.next())
|
||||
.then(value => {
|
||||
if (!value) {
|
||||
return cursor.close().then(() => ({ value, done: true }));
|
||||
}
|
||||
return { value, done: false };
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.asyncIterator = asyncIterator;
|
||||
Reference in New Issue
Block a user