mirror of
https://github.com/zadam/trilium.git
synced 2025-10-26 07:46:30 +01:00
refactor(sanitizeAttributeNames): use a ternary operator
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user