mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-30 01:17:01 +00:00
10 lines
348 B
TypeScript
10 lines
348 B
TypeScript
import crypto from "crypto";
|
|
|
|
export function generateUniqueName(baseName = "", length = 4): string {
|
|
return `${baseName}${crypto.randomBytes(length).toString("hex")}`;
|
|
}
|
|
|
|
export function generateDatabaseNameWithTimestamp(baseName = "db", length = 1): string {
|
|
return `${baseName}${crypto.randomBytes(length).toString("hex")}-${Date.now()}`;
|
|
}
|