Commit 3a0cf5b 1 parent dcfc8b8 commit 3a0cf5b Copy full SHA for 3a0cf5b
File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ function listenerCount(stream, evt) {
6
6
return stream . listeners ( evt ) . length ;
7
7
}
8
8
9
+ function hasListeners ( stream ) {
10
+ return ! ! ( listenerCount ( stream , 'readable' ) || listenerCount ( stream , 'data' ) ) ;
11
+ }
12
+
9
13
function sink ( stream ) {
10
14
var sinkStream = new Writable ( {
11
15
objectMode : true ,
@@ -19,7 +23,7 @@ function sink(stream) {
19
23
return ;
20
24
}
21
25
22
- if ( listenerCount ( stream , 'readable' ) || listenerCount ( stream , 'data' ) ) {
26
+ if ( hasListeners ( stream ) ) {
23
27
stream . unpipe ( sinkStream ) ;
24
28
}
25
29
}
@@ -28,7 +32,7 @@ function sink(stream) {
28
32
stream . on ( 'removeListener' , removeSink ) ;
29
33
30
34
return function ( ) {
31
- if ( listenerCount ( stream , 'readable' ) || listenerCount ( stream , 'data' ) ) {
35
+ if ( hasListeners ( stream ) ) {
32
36
return ;
33
37
}
34
38
You can’t perform that action at this time.
0 commit comments