first commit

This commit is contained in:
2024-08-12 17:08:47 +02:00
commit acd1f8cc7e
6 changed files with 141 additions and 0 deletions

14
worker.ts Normal file
View File

@@ -0,0 +1,14 @@
const singleTagRegEx = /<[^>]+?>/g;
const whitespaceRegEx = /(\s)\s+/g;
function clean(text: string): string {
text = text.replaceAll(whitespaceRegEx, "$1");
text = text.replaceAll(singleTagRegEx, "");
return text;
}
onmessage = (e) => {
const result = clean(e.data);
postMessage(result);
}