extract cleanIrcMessage from client to shared

This commit is contained in:
Reto Brunner 2023-01-29 17:04:41 +01:00
parent a8149c0f1a
commit 9d34955836
3 changed files with 7 additions and 2 deletions

View file

@ -1,6 +1,6 @@
import Msg, {MessageType} from "../../models/msg";
import LinkPrefetch from "./link";
import cleanIrcMessage from "../../../client/js/helpers/ircmessageparser/cleanIrcMessage";
import {cleanIrcMessage} from "../../../shared/irc";
import Helper from "../../helper";
import {IrcEventHandler} from "../../client";
import Chan, {ChanType} from "../../models/chan";

View file

@ -2,7 +2,6 @@
"extends": "../tsconfig.base.json" /* Path to base configuration file to inherit from. Requires TypeScript version 2.1 or later. */,
"include": [
"**/*",
"../client/js/helpers/ircmessageparser/*.ts",
"../shared/"
] /* Specifies a list of glob patterns that match files to be included in compilation. If no 'files' or 'include' property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories except those specified by 'exclude'. Requires TypeScript version 2.0 or later. */,
"files": [

6
shared/irc.ts Normal file
View file

@ -0,0 +1,6 @@
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;
export function cleanIrcMessage(message: string) {
return message.replace(matchFormatting, "").trim();
}