From a688fa07a6dadd2c841e8d12ed50a454670b7a56 Mon Sep 17 00:00:00 2001 From: Doug A Date: Tue, 9 Mar 2021 09:38:58 -0500 Subject: [PATCH] default value for opts object If the opts object is not passed, I'm getting a "cannot read host of undefined" error, which should be fixed by assigning a default opts of {} --- socket.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/socket.js b/socket.js index 8a20ab0..518781c 100644 --- a/socket.js +++ b/socket.js @@ -9,7 +9,7 @@ function isEventEmitter (o) { return typeof o === 'object' && o !== null && typeof o.on === 'function' } -module.exports = function getNetworkOptions (opts) { +module.exports = function getNetworkOptions (opts = {}) { if (isEventEmitter(opts)) return opts if (!opts.host && !opts.port) return getSocketPath() if (opts.host && !opts.port) return getSocketPath(opts.host)