From 5eb0109d53b3b5296e442bc7e9e33c5661ec67a4 Mon Sep 17 00:00:00 2001 From: Kazbek Askarov Date: Thu, 6 Nov 2025 12:37:35 +0500 Subject: [PATCH] Enhance documentation for _generateEventId function Added detailed documentation for the _generateEventId function, including parameters, return value, and examples. --- packages/auth/src/core/util/event_id.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/auth/src/core/util/event_id.ts b/packages/auth/src/core/util/event_id.ts index 6e2e02fca63..39ef2813e3e 100644 --- a/packages/auth/src/core/util/event_id.ts +++ b/packages/auth/src/core/util/event_id.ts @@ -15,6 +15,25 @@ * limitations under the License. */ +/** + * Generates a unique event identifier with a customizable prefix and length. + * + * This function creates a random alphanumeric string by repeatedly generating + * random numbers and concatenating their string representations. The resulting + * event ID consists of the provided prefix followed by a randomly generated + * string of the specified number of digits. + * + * @param prefix - The string to prepend to the generated random number sequence. Defaults to an empty string. + * @param digits - The number of random digits to generate for the event ID. Defaults to 10. + * @returns A string containing the prefix followed by the randomly generated digits. + * + * @example + * ```typescript + * _generateEventId('evt_', 8); // Returns something like: 'evt_12345678' + * _generateEventId(); // Returns something like: '1234567890' + * ``` + */ + export function _generateEventId(prefix = '', digits = 10): string { let random = ''; for (let i = 0; i < digits; i++) {