Add a helper application to manage attributes on characters

This commit is contained in:
Oliver-Akins 2025-06-29 13:35:11 -06:00
parent 91ccd93814
commit 6b81d8d83b
10 changed files with 298 additions and 12 deletions

13
module/utils/toID.mjs Normal file
View file

@ -0,0 +1,13 @@
/**
* A helper method that converts an arbitrary string into a format that can be
* used as an object key easily.
*
* @param {string} text The text to convert
* @returns The converted ID
*/
export function toID(text) {
return text
.toLowerCase()
.replace(/\s/g, `_`)
.replace(/\W/g, ``);
};