mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-18 00:02:28 +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("#escapeRegExp", () => {});
|
||||||
|
|
||||||
describe.todo("#crash", () => {});
|
describe.todo("#crash", () => {});
|
||||||
|
@ -104,29 +104,6 @@ export function stripTags(text: string) {
|
|||||||
return text.replace(/<(?:.|\n)*?>/gm, "");
|
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) {
|
export function escapeRegExp(str: string) {
|
||||||
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
|
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
|
||||||
}
|
}
|
||||||
@ -337,7 +314,6 @@ export default {
|
|||||||
unescapeHtml,
|
unescapeHtml,
|
||||||
toObject,
|
toObject,
|
||||||
stripTags,
|
stripTags,
|
||||||
union,
|
|
||||||
escapeRegExp,
|
escapeRegExp,
|
||||||
crash,
|
crash,
|
||||||
getContentDisposition,
|
getContentDisposition,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user