Notes/apps/server/src/services/sanitize_attribute_name.ts
2025-04-22 17:16:41 +03:00

7 lines
255 B
TypeScript

export default function sanitizeAttributeName(origName: string) {
const fixedName = origName === "" ? "unnamed" : origName.replace(/[^\p{L}\p{N}_:]/gu, "_");
// any not allowed character should be replaced with underscore
return fixedName;
}