mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-18 00:02:28 +08:00
19 lines
355 B
JavaScript
19 lines
355 B
JavaScript
![]() |
function sanitizeAttributeName(origName) {
|
||
|
let fixedName;
|
||
|
|
||
|
if (origName === '') {
|
||
|
fixedName = "unnamed";
|
||
|
}
|
||
|
else {
|
||
|
// any not allowed character should be replaced with underscore
|
||
|
fixedName = origName.replace(/[^\p{L}\p{N}_:]/ug, "_");
|
||
|
}
|
||
|
|
||
|
return fixedName;
|
||
|
}
|
||
|
|
||
|
|
||
|
module.exports = {
|
||
|
sanitizeAttributeName
|
||
|
};
|