mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-10 10:22:29 +08:00
refactor(server/utils): remove unused union
function is not used at all anywhere
This commit is contained in:
parent
45cf0334f1
commit
81db681732
@ -114,8 +114,6 @@ def</p>
|
||||
});
|
||||
});
|
||||
|
||||
describe.todo("#union", () => {});
|
||||
|
||||
describe.todo("#escapeRegExp", () => {});
|
||||
|
||||
describe.todo("#crash", () => {});
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user