mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 18:50:41 +01:00
refactor(services): use Set instead of Arrays for faster lookups
This commit is contained in:
@@ -9,7 +9,7 @@ import BUILTIN_ATTRIBUTES from "./builtin_attributes.js";
|
||||
import BNote from "../becca/entities/bnote.js";
|
||||
import { AttributeRow } from '../becca/entities/rows.js';
|
||||
|
||||
const ATTRIBUTE_TYPES = ['label', 'relation'];
|
||||
const ATTRIBUTE_TYPES = new Set(['label', 'relation']);
|
||||
|
||||
function getNotesWithLabel(name: string, value?: string): BNote[] {
|
||||
const query = attributeFormatter.formatAttrForSearch({type: 'label', name, value}, value !== undefined);
|
||||
@@ -99,7 +99,7 @@ function getAttributeNames(type: string, nameLike: string) {
|
||||
}
|
||||
|
||||
function isAttributeType(type: string): boolean {
|
||||
return ATTRIBUTE_TYPES.includes(type);
|
||||
return ATTRIBUTE_TYPES.has(type);
|
||||
}
|
||||
|
||||
function isAttributeDangerous(type: string, name: string): boolean {
|
||||
|
||||
Reference in New Issue
Block a user