Merge pull request #1814 from thelounge/xpaw/clean-extra

Clean monospace and strikethrough formatters
This commit is contained in:
Jérémie Astori 2017-12-08 19:05:04 -05:00 committed by GitHub
commit f32cd57bcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,5 @@
"use strict"; "use strict";
const matchFormatting = /\x02|\x1D|\x1F|\x16|\x0F|\x03(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?|\x04(?:[0-9a-f]{6}(?:,[0-9a-f]{6})?)?/gi; const matchFormatting = /\x02|\x1D|\x1F|\x16|\x0F|\x11|\x1E|\x03(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?|\x04(?:[0-9a-f]{6}(?:,[0-9a-f]{6})?)?/gi;
module.exports = (message) => message.replace(matchFormatting, "").trim(); module.exports = (message) => message.replace(matchFormatting, "").trim();

View File

@ -23,6 +23,15 @@ describe("cleanIrcMessage", function() {
}, { }, {
input: "\x1ditalic", input: "\x1ditalic",
expected: "italic", expected: "italic",
}, {
input: "\x1estrikethrough",
expected: "strikethrough",
}, {
input: "\x11monospace",
expected: "monospace",
}, {
input: "\x16reset color",
expected: "reset color",
}, { }, {
input: "\x1funderline", input: "\x1funderline",
expected: "underline", expected: "underline",