feature: vor und nachteile

This commit is contained in:
Hikyu
2026-05-31 13:54:31 +02:00
parent 552a947a1c
commit e3dad17446
23270 changed files with 3024794 additions and 200 deletions
+30
View File
@@ -0,0 +1,30 @@
//#region src/compat/util/uniqueId.ts
/** Counter used to generate unique numeric identifiers. */
let idCounter = 0;
/**
* Generates a unique identifier, optionally prefixed with a given string.
*
* @param {string} [prefix] - An optional string to prefix the unique identifier.
* If not provided or not a string, only the unique
* numeric identifier is returned.
* @returns {string} A string containing the unique identifier, with the optional
* prefix if provided.
*
* @example
* // Generate a unique ID with a prefix
* uniqueId('user_'); // => 'user_1'
*
* @example
* // Generate a unique ID without a prefix
* uniqueId(); // => '2'
*
* @example
* // Subsequent calls increment the internal counter
* uniqueId('item_'); // => 'item_3'
* uniqueId(); // => '4'
*/
function uniqueId(prefix = "") {
return `${prefix}${++idCounter}`;
}
//#endregion
export { uniqueId };