Merge pull request #1814 from thelounge/xpaw/clean-extra
Clean monospace and strikethrough formatters
This commit is contained in:
commit
f32cd57bcb
@ -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();
|
||||||
|
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user