mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
lib: replace Symbol.asyncIterator by SymbolAsyncIterator
PR-URL: https://github.com/nodejs/node/pull/30947 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
a8a04efac8
commit
497a1c8405
4 files changed
+10
-8
No files matched your search
@@ -27,7 +27,7 @@ const {
|
||||
NumberIsNaN,
|
||||
ObjectDefineProperty,
|
||||
ObjectSetPrototypeOf,
|
||||
Symbol,
|
||||
SymbolAsyncIterator,
|
||||
} = primordials;
|
||||
|
||||
module.exports = Readable;
|
||||
@@ -1073,7 +1073,7 @@ Readable.prototype.wrap = function(stream) {
|
||||
return this;
|
||||
};
|
||||
|
||||
Readable.prototype[Symbol.asyncIterator] = function() {
|
||||
Readable.prototype[SymbolAsyncIterator] = function() {
|
||||
if (createReadableStreamAsyncIterator === undefined) {
|
||||
createReadableStreamAsyncIterator =
|
||||
require('internal/streams/async_iterator');
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
const {
|
||||
ObjectDefineProperty,
|
||||
Symbol,
|
||||
SymbolAsyncIterator,
|
||||
} = primordials;
|
||||
|
||||
const pathModule = require('path');
|
||||
@@ -175,7 +176,7 @@ class Dir {
|
||||
}
|
||||
}
|
||||
|
||||
ObjectDefineProperty(Dir.prototype, Symbol.asyncIterator, {
|
||||
ObjectDefineProperty(Dir.prototype, SymbolAsyncIterator, {
|
||||
value: Dir.prototype.entries,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const {
|
||||
Symbol,
|
||||
SymbolAsyncIterator,
|
||||
SymbolIterator
|
||||
} = primordials;
|
||||
|
||||
@@ -11,8 +11,8 @@ const {
|
||||
|
||||
function from(Readable, iterable, opts) {
|
||||
let iterator;
|
||||
if (iterable && iterable[Symbol.asyncIterator])
|
||||
iterator = iterable[Symbol.asyncIterator]();
|
||||
if (iterable && iterable[SymbolAsyncIterator])
|
||||
iterator = iterable[SymbolAsyncIterator]();
|
||||
else if (iterable && iterable[SymbolIterator])
|
||||
iterator = iterable[SymbolIterator]();
|
||||
else
|
||||
|
||||
+3
-2
@@ -37,6 +37,7 @@ const {
|
||||
ObjectDefineProperty,
|
||||
ObjectSetPrototypeOf,
|
||||
Symbol,
|
||||
SymbolAsyncIterator,
|
||||
} = primordials;
|
||||
|
||||
const {
|
||||
@@ -1088,7 +1089,7 @@ Interface.prototype._ttyWrite = function(s, key) {
|
||||
}
|
||||
};
|
||||
|
||||
Interface.prototype[Symbol.asyncIterator] = function() {
|
||||
Interface.prototype[SymbolAsyncIterator] = function() {
|
||||
if (this[kLineObjectStream] === undefined) {
|
||||
if (Readable === undefined) {
|
||||
Readable = require('stream').Readable;
|
||||
@@ -1118,7 +1119,7 @@ Interface.prototype[Symbol.asyncIterator] = function() {
|
||||
this[kLineObjectStream] = readable;
|
||||
}
|
||||
|
||||
return this[kLineObjectStream][Symbol.asyncIterator]();
|
||||
return this[kLineObjectStream][SymbolAsyncIterator]();
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user