Moved applet-core functionalities to individual libs, Updated UUID and IBAN generators

Update iban-generator.mjs, uuid-generator.mjs, and 4 more files...
This commit is contained in:
2025-03-17 23:44:09 +01:00
parent 3e8ec44ae4
commit 18bb55cea9
6 changed files with 170 additions and 54 deletions

View File

@@ -0,0 +1,14 @@
/**
* Generates a random UUID4 and returns its string representation
* @returns {`${string}-${string}-${string}-${string}-${string}`}
*/
export function generateUUID4(addHyphens, addGuidBrackets) {
let uuid4 = crypto.randomUUID();
if(!addHyphens) {
uuid4 = uuid4.replace(/-/g, "");
}
if(addGuidBrackets) {
uuid4 = "{" + uuid4 + "}";
}
return uuid4;
}