From acdc0322537446599a8c59745357f93c3ecd0e36 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Wed, 7 Jul 2021 14:04:28 +1000 Subject: [PATCH] Simplify code --- src/lib/waku.ts | 2 +- src/lib/waku_relay/index.ts | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/lib/waku.ts b/src/lib/waku.ts index 92479dc842..8c3d7f3b6e 100644 --- a/src/lib/waku.ts +++ b/src/lib/waku.ts @@ -76,7 +76,7 @@ export class Waku { this.lightPush = lightPush; this.keepAliveTimers = {}; - const keepAlive = options.keepAlive !== undefined ? options.keepAlive : 0; + const keepAlive = options.keepAlive || 0; if (keepAlive !== 0) { libp2p.connectionManager.on('peer:connect', (connection: Connection) => { diff --git a/src/lib/waku_relay/index.ts b/src/lib/waku_relay/index.ts index 1366dd8b35..025dc43a02 100644 --- a/src/lib/waku_relay/index.ts +++ b/src/lib/waku_relay/index.ts @@ -87,11 +87,7 @@ export class WakuRelay extends Gossipsub { Object.assign(this, { multicodecs }); - if (options?.pubsubTopic) { - this.pubsubTopic = options.pubsubTopic; - } else { - this.pubsubTopic = constants.DefaultPubsubTopic; - } + this.pubsubTopic = options?.pubsubTopic || constants.DefaultPubsubTopic; } /**