@web3auth/ws-embed
Version:
Embed script
21 lines (18 loc) • 809 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);
}
exports.isDuplexStream = isDuplexStream;
exports.isReadableStream = isReadableStream;
exports.isStream = isStream;
exports.isWritableStream = isWritableStream;