Function: generateId()
generateId(
prefix
?,n
?):string
Generates a unique identifier with a given prefix and length.
Parameters
• prefix?: string
= 'racingbars'
The prefix to be added to the generated identifier. Default is 'racingbars'.
• n?: number
= 8
The length of the generated identifier. Default is 8.
Returns
string
The generated unique identifier.
Example
const id = generateId('hello', 5);
console.log(id); // Output: helloxxxxx
See
https://racing-bars.hatemhosny.dev/api/functions/generateId/ for more details.