diff --git a/packages/kalm/src/components/client.ts b/packages/kalm/src/components/client.ts index 1709c48..f761a83 100644 --- a/packages/kalm/src/components/client.ts +++ b/packages/kalm/src/components/client.ts @@ -11,7 +11,9 @@ export function Client(params: ClientConfig, emitter: NodeJS.EventEmitter, handl const channels: ChannelList = {}; const socket: Socket = params.transport(params, emitter); - if (!socket.connect) throw new Error('Transport is not valid, it may not have been invoked, see: https://github.com/kalm/kalm.js#documentation'); + if (!socket.connect) { + throw new Error('Transport is not valid, it may not have been invoked, see: https://github.com/kalm/kalm.js#documentation'); + } function _createChannel(channel: string): Channel { const channelEmitter: NodeJS.EventEmitter = new EventEmitter(); @@ -25,7 +27,9 @@ export function Client(params: ClientConfig, emitter: NodeJS.EventEmitter, handl } function _wrap(event: RawFrame): void { - const payload: Buffer = params.framing === 'kalm' ? serializeLegacy(event.frameId, channels[event.channel], event.packets) : Buffer.from(JSON.stringify({ frameId: event.frameId, channel: event.channel, packets: event.packets })); + const payload: Buffer = params.framing === 'kalm' + ? serializeLegacy(event.frameId, channels[event.channel], event.packets) + : Buffer.from(JSON.stringify({ frameId: event.frameId, channel: event.channel, packets: event.packets })); socket.send(handle, payload); } diff --git a/packages/kalm/src/components/provider.ts b/packages/kalm/src/components/provider.ts index 4817966..9df3683 100644 --- a/packages/kalm/src/components/provider.ts +++ b/packages/kalm/src/components/provider.ts @@ -10,7 +10,9 @@ export function Provider(params: ClientConfig, emitter: NodeJS.EventEmitter): Pr const connections = []; const socket: Socket = params.transport(params, emitter); - if (!socket.bind) throw new Error('Transport is not valid, it may not have been invoked, see: https://github.com/kalm/kalm.js#documentation'); + if (!socket.bind) { + throw new Error('Transport is not valid, it may not have been invoked, see: https://github.com/kalm/kalm.js#documentation'); + } function broadcast(channel: string, payload: Serializable): void { connections.forEach(c => c.write(channel, payload)); diff --git a/packages/kalm/src/kalm.ts b/packages/kalm/src/kalm.ts index ed4e61d..d29c73a 100644 --- a/packages/kalm/src/kalm.ts +++ b/packages/kalm/src/kalm.ts @@ -38,7 +38,9 @@ function validateOptions(options: ProviderConfig): void { throw new Error(`Routine is not a function (${options.routine}), see: https://github.com/kalm/kalm.js#documentation`); } const testChannel = options.routine('test', {}, {}, {}); - if (!testChannel.add) throw new Error('Routine is not valid, it may not have been invoked, see: https://github.com/kalm/kalm.js#documentation'); + if (!testChannel.add) { + throw new Error('Routine is not valid, it may not have been invoked, see: https://github.com/kalm/kalm.js#documentation'); + } } } diff --git a/packages/kalm/src/utils/parser.ts b/packages/kalm/src/utils/parser.ts index e46e089..418346d 100644 --- a/packages/kalm/src/utils/parser.ts +++ b/packages/kalm/src/utils/parser.ts @@ -24,7 +24,7 @@ export function serializeLegacy(frameId: number, channel: Channel, packets: Buff ...packets.map((packet: Buffer) => { if (!(packet instanceof Buffer)) throw new Error(`Cannot send packet ${packet}. Must be of type Buffer`); return Buffer.concat([doubleIndiceBuffer(packet.length), packet]); - }) + }), ]); }