8
8
9
9
const kDestroyed = Symbol ( 'kDestroyed' ) ;
10
10
11
- function isReadableStream ( obj ) {
11
+ function isReadableNodeStream ( obj ) {
12
12
return ! ! (
13
13
obj &&
14
14
typeof obj . pipe === 'function' &&
@@ -18,7 +18,7 @@ function isReadableStream(obj) {
18
18
) ;
19
19
}
20
20
21
- function isWritableStream ( obj ) {
21
+ function isWritableNodeStream ( obj ) {
22
22
return ! ! (
23
23
obj &&
24
24
typeof obj . write === 'function' &&
@@ -27,8 +27,8 @@ function isWritableStream(obj) {
27
27
) ;
28
28
}
29
29
30
- function isStream ( obj ) {
31
- return isReadableStream ( obj ) || isWritableStream ( obj ) ;
30
+ function isNodeStream ( obj ) {
31
+ return isReadableNodeStream ( obj ) || isWritableNodeStream ( obj ) ;
32
32
}
33
33
34
34
function isIterable ( obj , isAsync ) {
@@ -40,7 +40,7 @@ function isIterable(obj, isAsync) {
40
40
}
41
41
42
42
function isDestroyed ( stream ) {
43
- if ( ! isStream ( stream ) ) return null ;
43
+ if ( ! isNodeStream ( stream ) ) return null ;
44
44
const wState = stream . _writableState ;
45
45
const rState = stream . _readableState ;
46
46
const state = wState || rState ;
@@ -49,7 +49,7 @@ function isDestroyed(stream) {
49
49
50
50
// Have been end():d.
51
51
function isWritableEnded ( stream ) {
52
- if ( ! isWritableStream ( stream ) ) return null ;
52
+ if ( ! isWritableNodeStream ( stream ) ) return null ;
53
53
if ( stream . writableEnded === true ) return true ;
54
54
const wState = stream . _writableState ;
55
55
if ( wState ?. errored ) return false ;
@@ -59,7 +59,7 @@ function isWritableEnded(stream) {
59
59
60
60
// Have emitted 'finish'.
61
61
function isWritableFinished ( stream , strict ) {
62
- if ( ! isWritableStream ( stream ) ) return null ;
62
+ if ( ! isWritableNodeStream ( stream ) ) return null ;
63
63
if ( stream . writableFinished === true ) return true ;
64
64
const wState = stream . _writableState ;
65
65
if ( wState ?. errored ) return false ;
@@ -72,7 +72,7 @@ function isWritableFinished(stream, strict) {
72
72
73
73
// Have been push(null):d.
74
74
function isReadableEnded ( stream ) {
75
- if ( ! isReadableStream ( stream ) ) return null ;
75
+ if ( ! isReadableNodeStream ( stream ) ) return null ;
76
76
if ( stream . readableEnded === true ) return true ;
77
77
const rState = stream . _readableState ;
78
78
if ( ! rState || rState . errored ) return false ;
@@ -82,7 +82,7 @@ function isReadableEnded(stream) {
82
82
83
83
// Have emitted 'end'.
84
84
function isReadableFinished ( stream , strict ) {
85
- if ( ! isReadableStream ( stream ) ) return null ;
85
+ if ( ! isReadableNodeStream ( stream ) ) return null ;
86
86
const rState = stream . _readableState ;
87
87
if ( rState ?. errored ) return false ;
88
88
if ( typeof rState ?. endEmitted !== 'boolean' ) return null ;
@@ -93,21 +93,21 @@ function isReadableFinished(stream, strict) {
93
93
}
94
94
95
95
function isReadable ( stream ) {
96
- const r = isReadableStream ( stream ) ;
96
+ const r = isReadableNodeStream ( stream ) ;
97
97
if ( r === null || typeof stream . readable !== 'boolean' ) return null ;
98
98
if ( isDestroyed ( stream ) ) return false ;
99
99
return r && stream . readable && ! isReadableFinished ( stream ) ;
100
100
}
101
101
102
102
function isWritable ( stream ) {
103
- const r = isWritableStream ( stream ) ;
103
+ const r = isWritableNodeStream ( stream ) ;
104
104
if ( r === null || typeof stream . writable !== 'boolean' ) return null ;
105
105
if ( isDestroyed ( stream ) ) return false ;
106
106
return r && stream . writable && ! isWritableEnded ( stream ) ;
107
107
}
108
108
109
109
function isFinished ( stream , opts ) {
110
- if ( ! isStream ( stream ) ) {
110
+ if ( ! isNodeStream ( stream ) ) {
111
111
return null ;
112
112
}
113
113
@@ -127,7 +127,7 @@ function isFinished(stream, opts) {
127
127
}
128
128
129
129
function isClosed ( stream ) {
130
- if ( ! isStream ( stream ) ) {
130
+ if ( ! isNodeStream ( stream ) ) {
131
131
return null ;
132
132
}
133
133
@@ -173,7 +173,7 @@ function isServerRequest(stream) {
173
173
}
174
174
175
175
function willEmitClose ( stream ) {
176
- if ( ! isStream ( stream ) ) return null ;
176
+ if ( ! isNodeStream ( stream ) ) return null ;
177
177
178
178
const wState = stream . _writableState ;
179
179
const rState = stream . _readableState ;
@@ -194,12 +194,12 @@ module.exports = {
194
194
isFinished,
195
195
isIterable,
196
196
isReadable,
197
- isReadableStream ,
197
+ isReadableNodeStream ,
198
198
isReadableEnded,
199
199
isReadableFinished,
200
- isStream ,
200
+ isNodeStream ,
201
201
isWritable,
202
- isWritableStream ,
202
+ isWritableNodeStream ,
203
203
isWritableEnded,
204
204
isWritableFinished,
205
205
isServerRequest,
0 commit comments