add isProtomux helper

This commit is contained in:
Mathias Buus 2022-03-11 02:18:31 +01:00
parent 79ce9e21f8
commit 8aff462da3
1 changed files with 4 additions and 0 deletions

View File

@ -263,6 +263,10 @@ module.exports = class Protomux {
return new this(stream, opts)
}
static isProtomux (mux) {
return typeof mux === 'object' && mux.isProtomux === true
}
* [Symbol.iterator] () {
for (const session of this._local) {
if (session !== null) yield session