Clean monospace and strikethrough formatters

This commit is contained in:
Pavel Djundik 2017-12-08 21:09:23 +02:00
parent 7bbd3d61d5
commit b391b87e29
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",