mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
16 lines
411 B
JavaScript
16 lines
411 B
JavaScript
//#region src/string/generate-id.ts
|
|
/**
|
|
* Generate a unique-ish string ID via timestamp + random.
|
|
*
|
|
* @returns String in `timestamp-random` format (e.g. `"1738423156789-542891"`).
|
|
*
|
|
* @example
|
|
* const id = generateId(); // "1738423156789-542891"
|
|
*/
|
|
function generateId() {
|
|
return `${Date.now()}-${Math.floor(Math.random() * 1e6)}`;
|
|
}
|
|
//#endregion
|
|
export { generateId };
|
|
|
|
//# sourceMappingURL=generate-id.js.map
|