From 8aff462da34195cb329cbcb825a3a1c4e7ed4948 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Fri, 11 Mar 2022 02:18:31 +0100 Subject: [PATCH] add isProtomux helper --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 73fadaf..cf0b25f 100644 --- a/index.js +++ b/index.js @@ -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