Skip to content

Commit ffb1c85

Browse files
xtx1130juanarbol
authored andcommitted
stream: refactor use es2020 statement
PR-URL: #44533 Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Erick Wendel <[email protected]>
1 parent eaf2ffc commit ffb1c85

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎lib/internal/streams/destroy.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function destroy(err, cb){
3535
// With duplex streams we use the writable side for state.
3636
consts=w||r;
3737

38-
if((w&&w.destroyed)||(r&&r.destroyed)){
38+
if(w?.destroyed||r?.destroyed){
3939
if(typeofcb==='function'){
4040
cb();
4141
}
@@ -134,7 +134,7 @@ function emitCloseNT(self){
134134
r.closeEmitted=true;
135135
}
136136

137-
if((w&&w.emitClose)||(r&&r.emitClose)){
137+
if(w?.emitClose||r?.emitClose){
138138
self.emit('close');
139139
}
140140
}
@@ -143,7 +143,7 @@ function emitErrorNT(self, err){
143143
constr=self._readableState;
144144
constw=self._writableState;
145145

146-
if((w&&w.errorEmitted)||(r&&r.errorEmitted)){
146+
if(w?.errorEmitted||r?.errorEmitted){
147147
return;
148148
}
149149

@@ -198,11 +198,11 @@ function errorOrDestroy(stream, err, sync){
198198
constr=stream._readableState;
199199
constw=stream._writableState;
200200

201-
if((w&&w.destroyed)||(r&&r.destroyed)){
201+
if(w?.destroyed||r?.destroyed){
202202
returnthis;
203203
}
204204

205-
if((r&&r.autoDestroy)||(w&&w.autoDestroy))
205+
if(r?.autoDestroy||w?.autoDestroy)
206206
stream.destroy(err);
207207
elseif(err){
208208
// Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364
@@ -306,7 +306,7 @@ function emitConstructNT(stream){
306306
}
307307

308308
functionisRequest(stream){
309-
returnstream&&stream.setHeader&&typeofstream.abort==='function';
309+
returnstream?.setHeader&&typeofstream.abort==='function';
310310
}
311311

312312
// Normalize destroy for legacy.

0 commit comments

Comments
(0)