mirror of
https://github.com/zadam/trilium.git
synced 2025-11-16 18:25:51 +01:00
refactor(sanitizeAttributeNames): directly export function
no need to wrap the exported function in an object first
This commit is contained in:
@@ -754,7 +754,7 @@ class ConsistencyChecks {
|
||||
const attrNames = sql.getColumn<string>(`SELECT DISTINCT name FROM attributes`);
|
||||
|
||||
for (const origName of attrNames) {
|
||||
const fixedName = sanitizeAttributeName.sanitizeAttributeName(origName);
|
||||
const fixedName = sanitizeAttributeName(origName);
|
||||
|
||||
if (fixedName !== origName) {
|
||||
if (this.autoFix) {
|
||||
|
||||
@@ -151,7 +151,7 @@ function importEnex(taskContext: TaskContext, file: File, parentNote: BNote): Pr
|
||||
labelName = 'pageUrl';
|
||||
}
|
||||
|
||||
labelName = sanitizeAttributeName.sanitizeAttributeName(labelName || "");
|
||||
labelName = sanitizeAttributeName(labelName || "");
|
||||
|
||||
if (note.attributes) {
|
||||
note.attributes.push({
|
||||
@@ -202,7 +202,7 @@ function importEnex(taskContext: TaskContext, file: File, parentNote: BNote): Pr
|
||||
} else if (currentTag === 'tag' && note.attributes) {
|
||||
note.attributes.push({
|
||||
type: 'label',
|
||||
name: sanitizeAttributeName.sanitizeAttributeName(text),
|
||||
name: sanitizeAttributeName(text),
|
||||
value: ''
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function sanitizeAttributeName(origName: string) {
|
||||
export default function sanitizeAttributeName(origName: string) {
|
||||
let fixedName: string;
|
||||
|
||||
if (origName === '') {
|
||||
@@ -10,9 +10,4 @@ function sanitizeAttributeName(origName: string) {
|
||||
}
|
||||
|
||||
return fixedName;
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
sanitizeAttributeName
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user