MCPcopy Create free account
hub / github.com/Maccoder3/MAC-MD / isReadableNodeStream

Function isReadableNodeStream

lib/helper.js:94–105  ·  view source on GitHub ↗
(obj, strict = false)

Source from the content-addressed store, hash-verified

92const kDestroyed = Symbol('kDestroyed')
93const kIsReadable = Symbol('kIsReadable')
94const isReadableNodeStream = (obj, strict = false) => {
95 return !!(
96 (
97 obj &&
98 typeof obj.pipe === 'function' &&
99 typeof obj.on === 'function' &&
100 (!strict || (typeof obj.pause === 'function' && typeof obj.resume === 'function')) &&
101 (!obj._writableState || obj._readableState?.readable !== false) && // Duplex
102 (!obj._writableState || obj._readableState)
103 ) // Writable has .pipe.
104 )
105}
106const isNodeStream = obj => {
107 return (
108 obj &&

Callers 2

isReadableFinishedFunction · 0.85
isReadableStreamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected