@scania/tegel
Version:
Tegel Design System
16 lines (15 loc) • 750 B
TypeScript
/**
* Generates a reasonably unique string ID based on current time (minutes, seconds, milliseconds) and random numbers.
*
* This function combines the current time and random numbers to generate
* a unique string ID. The function assumes that it won't be called frequently
* enough to generate two identical IDs within a millisecond, or that the random
* number generator will produce the same value twice in quick succession.
*
* Note: The IDs generated by this function are not globally unique and their length may vary.
* For truly unique and fixed-length IDs, consider using a more robust method such as UUID.
*
* @returns {string} A unique string ID.
*/
declare function generateUniqueId(): string;
export default generateUniqueId;