mirror of https://github.com/waku-org/js-waku.git
style: use nullish coalescing instead of if/then
This commit is contained in:
parent
a3e6850b2f
commit
4a193e49e0
|
@ -40,11 +40,7 @@ export class WakuLightPush {
|
||||||
pubSubTopic: string;
|
pubSubTopic: string;
|
||||||
|
|
||||||
constructor(public libp2p: Libp2p, options?: CreateOptions) {
|
constructor(public libp2p: Libp2p, options?: CreateOptions) {
|
||||||
if (options?.pubSubTopic) {
|
this.pubSubTopic = options?.pubSubTopic ?? DefaultPubSubTopic;
|
||||||
this.pubSubTopic = options.pubSubTopic;
|
|
||||||
} else {
|
|
||||||
this.pubSubTopic = DefaultPubSubTopic;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async push(
|
async push(
|
||||||
|
|
|
@ -55,7 +55,7 @@ export class WakuRelay extends GossipSub {
|
||||||
this.observers = {};
|
this.observers = {};
|
||||||
this.decryptionKeys = new Map();
|
this.decryptionKeys = new Map();
|
||||||
|
|
||||||
this.pubSubTopic = options?.pubSubTopic || DefaultPubSubTopic;
|
this.pubSubTopic = options?.pubSubTopic ?? DefaultPubSubTopic;
|
||||||
|
|
||||||
options?.decryptionKeys?.forEach((key) => {
|
options?.decryptionKeys?.forEach((key) => {
|
||||||
this.addDecryptionKey(key);
|
this.addDecryptionKey(key);
|
||||||
|
|
|
@ -103,11 +103,7 @@ export class WakuStore {
|
||||||
>;
|
>;
|
||||||
|
|
||||||
constructor(public libp2p: Libp2p, options?: CreateOptions) {
|
constructor(public libp2p: Libp2p, options?: CreateOptions) {
|
||||||
if (options?.pubSubTopic) {
|
this.pubSubTopic = options?.pubSubTopic ?? DefaultPubSubTopic;
|
||||||
this.pubSubTopic = options.pubSubTopic;
|
|
||||||
} else {
|
|
||||||
this.pubSubTopic = DefaultPubSubTopic;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.decryptionKeys = new Map();
|
this.decryptionKeys = new Map();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue