Skip to content

Commit

Permalink
Update lib/message/parser/tags.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Brian <18603393+brian6932@users.noreply.github.com>
  • Loading branch information
KararTY and brian6932 committed Nov 15, 2023
1 parent 8a6b359 commit 0a317de
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/message/parser/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ export function parseTags(tagsSrc: string | undefined): IRCMessageTags {
for (const tagSrc of tagsSrc.split(";")) {
const key = tagSrc.split("=").shift() as string;

Check warning on line 30 in lib/message/parser/tags.ts

View workflow job for this annotation

GitHub Actions / build (14)

'key' is assigned a value but never used

Check warning on line 30 in lib/message/parser/tags.ts

View workflow job for this annotation

GitHub Actions / build (16)

'key' is assigned a value but never used

Check warning on line 30 in lib/message/parser/tags.ts

View workflow job for this annotation

GitHub Actions / build (18)

'key' is assigned a value but never used

Check warning on line 30 in lib/message/parser/tags.ts

View workflow job for this annotation

GitHub Actions / build (14)

'key' is assigned a value but never used

Check warning on line 30 in lib/message/parser/tags.ts

View workflow job for this annotation

GitHub Actions / build (16)

'key' is assigned a value but never used

Check warning on line 30 in lib/message/parser/tags.ts

View workflow job for this annotation

GitHub Actions / build (18)

'key' is assigned a value but never used

let valueSrc;
const indexOfFirstSeparator = tagSrc.indexOf("=");
if (indexOfFirstSeparator !== -1) {
valueSrc = tagSrc.slice(indexOfFirstSeparator + 1);
}
const keyValueDelimiter: number = tagSrc.indexOf("=");

tags[key.toLowerCase()] = decodeValue(valueSrc);
tags[tagSrc.slice(0, keyValueDelimiter)] =
keyValueDelimiter === -1
? null
: decodeValue(tagSrc.slice(keyValueDelimiter + 1));
}

return tags;
Expand Down

0 comments on commit 0a317de

Please sign in to comment.