@cognigy/rest-api-client
Version:
Cognigy REST-Client
16 lines • 627 B
JavaScript
/**
* Generates a unique ID for a profile memory entry.
*
* This function creates a unique identifier by combining a truncated
* base-36 encoded timestamp with a random base-36 string.
*
* @returns {string} A alphanumeric 6-character unique ID for a profile memory entry.
*/
export const generateUniqueMemoryId = () => {
const timestamp = Date.now();
const timestampPart = timestamp.toString(36).slice(-4);
const randomPart = Math.random().toString(36).substring(2, 4);
const combined = (timestampPart + randomPart).slice(0, 6);
return combined.padStart(6, '0');
};
//# sourceMappingURL=helper.js.map