File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
packages/auth/src/core/util Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 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+
1837export function _generateEventId ( prefix = '' , digits = 10 ) : string {
1938 let random = '' ;
2039 for ( let i = 0 ; i < digits ; i ++ ) {
You can’t perform that action at this time.
0 commit comments