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";
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();

View file

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