diff --git a/irc/parser.ts b/irc/parser.ts index 4c69bb9..be6202b 100644 --- a/irc/parser.ts +++ b/irc/parser.ts @@ -18,7 +18,7 @@ export interface IIRCLine { } function parseERROR(line: string[]): IIRCLine { - let final: IIRCLine = { + const final: IIRCLine = { user: { nickname: '', username: '', hostname: '' }, command: 'ERROR', trailing: '', @@ -36,7 +36,7 @@ function parseERROR(line: string[]): IIRCLine { } export function parse(rawline: string): IIRCLine { - let final: IIRCLine = { + const final: IIRCLine = { user: { nickname: '', username: '', @@ -48,15 +48,15 @@ export function parse(rawline: string): IIRCLine { raw: rawline }; - let pass1 = (rawline.indexOf(':') === 0 ? rawline.substring(1).split(' ') : rawline.split(' ')); + const pass1 = (rawline.indexOf(':') === 0 ? rawline.substring(1).split(' ') : rawline.split(' ')); if (pass1[0] === 'ERROR') { return parseERROR(pass1); } if (pass1[0].indexOf('!') !== -1) { - let nickuser = pass1[0].split('!'); + const nickuser = pass1[0].split('!'); final.user.nickname = nickuser[0]; - let userhost = nickuser[1].split('@'); + const userhost = nickuser[1].split('@'); final.user.username = userhost[0]; final.user.hostname = userhost[1]; } else { @@ -65,7 +65,7 @@ export function parse(rawline: string): IIRCLine { final.command = pass1[1]; - let pass2 = pass1.slice(2).join(' '); + const pass2 = pass1.slice(2).join(' '); if (pass2.indexOf(':') !== -1) { final.arguments = pass2.substring(0, pass2.indexOf(' :')).split(' '); final.trailing = pass2.substring(pass2.indexOf(':') + 1); @@ -73,5 +73,5 @@ export function parse(rawline: string): IIRCLine { final.arguments = pass2.split(' '); } - return final + return final; }