Skip to content

Commit 5eb0109

Browse files
author
Kazbek Askarov
authored
Enhance documentation for _generateEventId function
Added detailed documentation for the _generateEventId function, including parameters, return value, and examples.
1 parent 0800a8b commit 5eb0109

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/auth/src/core/util/event_id.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,25 @@
1515
* limitations under the License.
1616
*/
1717

18+
/**
19+
* Generates a unique event identifier with a customizable prefix and length.
20+
*
21+
* This function creates a random alphanumeric string by repeatedly generating
22+
* random numbers and concatenating their string representations. The resulting
23+
* event ID consists of the provided prefix followed by a randomly generated
24+
* string of the specified number of digits.
25+
*
26+
* @param prefix - The string to prepend to the generated random number sequence. Defaults to an empty string.
27+
* @param digits - The number of random digits to generate for the event ID. Defaults to 10.
28+
* @returns A string containing the prefix followed by the randomly generated digits.
29+
*
30+
* @example
31+
* ```typescript
32+
* _generateEventId('evt_', 8); // Returns something like: 'evt_12345678'
33+
* _generateEventId(); // Returns something like: '1234567890'
34+
* ```
35+
*/
36+
1837
export function _generateEventId(prefix = '', digits = 10): string {
1938
let random = '';
2039
for (let i = 0; i < digits; i++) {

0 commit comments

Comments
 (0)