diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 42cd3cbbbab4a6..c2e863b27df179 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -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'); diff --git a/lib/internal/fs/dir.js b/lib/internal/fs/dir.js index 749e22ee696c6f..1351ce6c245281 100644 --- a/lib/internal/fs/dir.js +++ b/lib/internal/fs/dir.js @@ -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, diff --git a/lib/internal/streams/from.js b/lib/internal/streams/from.js index a060638df2dcfe..ea1d09d88982aa 100644 --- a/lib/internal/streams/from.js +++ b/lib/internal/streams/from.js @@ -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 diff --git a/lib/readline.js b/lib/readline.js index 2321fd8f62c4e7..35ed6a4e29d895 100644 --- a/lib/readline.js +++ b/lib/readline.js @@ -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](); }; /**