Skip to content

Commit 22df5dc

Browse files
Sebastien-Ahkrintargos
authored andcommitted
lib: replace Symbol.iterator by SymbolIterator
PR-URL: #30859 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 54aa3b9 commit 22df5dc

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

‎lib/internal/streams/buffer_list.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const{
4-
Symbol,
4+
SymbolIterator,
55
}=primordials;
66

77
const{ Buffer }=require('buffer');
@@ -94,7 +94,7 @@ module.exports = class BufferList {
9494
returnthis.head.data;
9595
}
9696

97-
*[Symbol.iterator](){
97+
*[SymbolIterator](){
9898
for(letp=this.head;p;p=p.next){
9999
yieldp.data;
100100
}

‎lib/internal/streams/from.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const{
44
Symbol,
5+
SymbolIterator
56
}=primordials;
67

78
const{
@@ -12,8 +13,8 @@ function from(Readable, iterable, opts) {
1213
letiterator;
1314
if(iterable&&iterable[Symbol.asyncIterator])
1415
iterator=iterable[Symbol.asyncIterator]();
15-
elseif(iterable&&iterable[Symbol.iterator])
16-
iterator=iterable[Symbol.iterator]();
16+
elseif(iterable&&iterable[SymbolIterator])
17+
iterator=iterable[SymbolIterator]();
1718
else
1819
thrownewERR_INVALID_ARG_TYPE('iterable',['Iterable'],iterable);
1920

‎lib/internal/url.js‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const {
1212
ReflectGetOwnPropertyDescriptor,
1313
ReflectOwnKeys,
1414
Symbol,
15+
SymbolIterator,
1516
}=primordials;
1617

1718
const{ inspect }=require('internal/util/inspect');
@@ -87,7 +88,7 @@ const kFormat = Symbol('format');
8788

8889
// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
8990
constIteratorPrototype=ObjectGetPrototypeOf(
90-
ObjectGetPrototypeOf([][Symbol.iterator]())
91+
ObjectGetPrototypeOf([][SymbolIterator]())
9192
);
9293

9394
constunpairedSurrogateRe=
@@ -139,8 +140,8 @@ class URLSearchParams {
139140
if(init===null||init===undefined){
140141
this[searchParams]=[];
141142
}elseif(typeofinit==='object'||typeofinit==='function'){
142-
constmethod=init[Symbol.iterator];
143-
if(method===this[Symbol.iterator]){
143+
constmethod=init[SymbolIterator];
144+
if(method===this[SymbolIterator]){
144145
// While the spec does not have this branch, we can use it as a
145146
// shortcut to avoid having to go through the costly generic iterator.
146147
constchildParams=init[searchParams];
@@ -156,7 +157,7 @@ class URLSearchParams {
156157
for(constpairofinit){
157158
if((typeofpair!=='object'&&typeofpair!=='function')||
158159
pair===null||
159-
typeofpair[Symbol.iterator]!=='function'){
160+
typeofpair[SymbolIterator]!=='function'){
160161
thrownewERR_INVALID_TUPLE('Each query pair','[name, value]');
161162
}
162163
constconvertedPair=[];
@@ -1149,7 +1150,7 @@ defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', {
11491150
});
11501151

11511152
// https://heycam.github.io/webidl/#es-iterable-entries
1152-
ObjectDefineProperty(URLSearchParams.prototype,Symbol.iterator,{
1153+
ObjectDefineProperty(URLSearchParams.prototype,SymbolIterator,{
11531154
writable: true,
11541155
configurable: true,
11551156
value: URLSearchParams.prototype.entries

0 commit comments

Comments
 (0)