@web3auth/ws-embed
Version:
Embed script
16 lines (14 loc) • 707 B
JavaScript
/* eslint-disable @typescript-eslint/no-explicit-any */
function isStream(stream) {
return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
}
function isWritableStream(stream) {
return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
}
function isReadableStream(stream) {
return isStream(stream) && stream.readable !== false && typeof stream._read === "function" && typeof stream._readableState === "object";
}
function isDuplexStream(stream) {
return isWritableStream(stream) && isReadableStream(stream);
}
export { isDuplexStream, isReadableStream, isStream, isWritableStream };