Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(sanitizeAttributeNames): use a ternary operator
Panagiotis Papadopoulos1053da3e405b
diff --git a/src/services/sanitize_attribute_name.ts b/src/services/sanitize_attribute_name.tsindex 075ccfd038..b1f0e65798 100644--- a/src/services/sanitize_attribute_name.ts+++ b/src/services/sanitize_attribute_name.ts@@ -1,13 +1,8 @@export default function sanitizeAttributeName(origName: string) {- let fixedName: string;-- if (origName === '') {- fixedName = "unnamed";- }- else {+ const fixedName = (origName === '')+ ? "unnamed"+ : origName.replace(/[^\p{L}\p{N}_:]/ug, "_");// any not allowed character should be replaced with underscore- fixedName = origName.replace(/[^\p{L}\p{N}_:]/ug, "_");- }return fixedName;}\ No newline at end of file