mirror of
https://github.com/zadam/trilium.git
synced 2025-12-23 16:49:58 +01:00
refactor(services): use Set instead of Arrays for faster lookups
This commit is contained in:
@@ -152,19 +152,19 @@ function getContentDisposition(filename: string) {
|
||||
return `file; filename="${sanitizedFilename}"; filename*=UTF-8''${sanitizedFilename}`;
|
||||
}
|
||||
|
||||
const STRING_MIME_TYPES = [
|
||||
const STRING_MIME_TYPES = new Set([
|
||||
"application/javascript",
|
||||
"application/x-javascript",
|
||||
"application/json",
|
||||
"application/x-sql",
|
||||
"image/svg+xml"
|
||||
];
|
||||
]);
|
||||
|
||||
function isStringNote(type: string | undefined, mime: string) {
|
||||
// render and book are string note in the sense that they are expected to contain empty string
|
||||
return (type && ["text", "code", "relationMap", "search", "render", "book", "mermaid", "canvas"].includes(type))
|
||||
|| mime.startsWith('text/')
|
||||
|| STRING_MIME_TYPES.includes(mime);
|
||||
|| STRING_MIME_TYPES.has(mime);
|
||||
}
|
||||
|
||||
function quoteRegex(url: string) {
|
||||
|
||||
Reference in New Issue
Block a user