refactor(server/utils): remove unused union

function is not used at all anywhere
This commit is contained in:
Panagiotis Papadopoulos 2025-01-29 21:34:47 +01:00
parent 45cf0334f1
commit 81db681732
2 changed files with 0 additions and 26 deletions

View File

@ -114,8 +114,6 @@ def</p>
});
});
describe.todo("#union", () => {});
describe.todo("#escapeRegExp", () => {});
describe.todo("#crash", () => {});

View File

@ -104,29 +104,6 @@ export function stripTags(text: string) {
return text.replace(/<(?:.|\n)*?>/gm, "");
}
export function union<T extends string | number | symbol>(a: T[], b: T[]): T[] {
const obj: Record<T, T> = {} as Record<T, T>; // TODO: unsafe?
for (let i = a.length - 1; i >= 0; i--) {
obj[a[i]] = a[i];
}
for (let i = b.length - 1; i >= 0; i--) {
obj[b[i]] = b[i];
}
const res: T[] = [];
for (const k in obj) {
if (obj.hasOwnProperty(k)) {
// <-- optional
res.push(obj[k]);
}
}
return res;
}
export function escapeRegExp(str: string) {
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
@ -337,7 +314,6 @@ export default {
unescapeHtml,
toObject,
stripTags,
union,
escapeRegExp,
crash,
getContentDisposition,