Skip to content

Commit

Permalink
stream: avoid usage of deprecated APIs
Browse files Browse the repository at this point in the history
Avoid usage of the `events.listenerCount()` method as it is
deprecated.
  • Loading branch information
VoltrexKeyva committed Feb 7, 2022
1 parent ff90d95 commit 57e292d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/internal/streams/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
debug('onerror', er);
unpipe();
dest.removeListener('error', onerror);
if (EE.listenerCount(dest, 'error') === 0) {
if (dest.listenerCount('error') === 0) {
const s = dest._writableState || dest._readableState;
if (s && !s.errorEmitted) {
// User incorrectly emitted 'error' directly on the stream.
Expand Down Expand Up @@ -852,7 +852,7 @@ function pipeOnDrain(src, dest) {
}

if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) &&
EE.listenerCount(src, 'data')) {
src.listenerCount('data')) {
src.resume();
}
};
Expand Down

0 comments on commit 57e292d

Please sign in to comment.