UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

20 lines 795 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateUniqueMemoryId = void 0; /** * 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. */ 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'); }; exports.generateUniqueMemoryId = generateUniqueMemoryId; //# sourceMappingURL=helper.js.map