feat: burg group editor - form

This commit is contained in:
Azgaar 2024-10-02 03:12:45 +02:00
parent 32808605b3
commit d8009f84ad
8 changed files with 156 additions and 53 deletions

View file

@ -56,3 +56,18 @@ JSON.isValid = str => {
}
return true;
};
function sanitizeId(string) {
if (!string) throw new Error("No string provided");
let sanitized = string
.toLowerCase()
.trim()
.replace(/[^a-z0-9-_]/g, "") // no invalid characters
.replace(/\s+/g, "-"); // replace spaces with hyphens
// remove leading numbers
if (sanitized.match(/^\d/)) sanitized = "_" + sanitized;
return sanitized;
}