first commit
This commit is contained in:
14
worker.ts
Normal file
14
worker.ts
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user