cosmos-explorer/test/utils/shared.ts

10 lines
348 B
TypeScript
Raw Normal View History

import crypto from "crypto";
export function generateUniqueName(baseName = "", length = 4): string {
return `${baseName}${crypto.randomBytes(length).toString("hex")}`;
}
2021-04-21 18:45:34 +01:00
export function generateDatabaseNameWithTimestamp(baseName = "db", length = 1): string {
return `${baseName}${crypto.randomBytes(length).toString("hex")}-${Date.now()}`;
}