Some checks failed
CI/CD Pipeline / unit-tests (push) Failing after 1m16s
CI/CD Pipeline / integration-tests (push) Failing after 2m32s
CI/CD Pipeline / lint (push) Successful in 5m22s
CI/CD Pipeline / e2e-tests (push) Has been skipped
CI/CD Pipeline / build (push) Has been skipped
30 lines
746 B
JavaScript
30 lines
746 B
JavaScript
export function isStream(stream) {
|
|
return stream !== null
|
|
&& typeof stream === 'object'
|
|
&& typeof stream.pipe === 'function';
|
|
}
|
|
|
|
export function isWritableStream(stream) {
|
|
return isStream(stream)
|
|
&& stream.writable !== false
|
|
&& typeof stream._write === 'function'
|
|
&& typeof stream._writableState === 'object';
|
|
}
|
|
|
|
export function isReadableStream(stream) {
|
|
return isStream(stream)
|
|
&& stream.readable !== false
|
|
&& typeof stream._read === 'function'
|
|
&& typeof stream._readableState === 'object';
|
|
}
|
|
|
|
export function isDuplexStream(stream) {
|
|
return isWritableStream(stream)
|
|
&& isReadableStream(stream);
|
|
}
|
|
|
|
export function isTransformStream(stream) {
|
|
return isDuplexStream(stream)
|
|
&& typeof stream._transform === 'function';
|
|
}
|