UNPKG

genezio

Version:

Command line utility to interact with Genezio infrastructure.

21 lines (20 loc) 584 B
import { uniqueNamesGenerator, adjectives, colors, animals } from "unique-names-generator"; export function generateRandomSubdomain() { const name = uniqueNamesGenerator({ dictionaries: [colors, adjectives, animals], separator: "-", style: "lowerCase", length: 3, }); return name; } export function isUnique(units, fieldName) { const unitSet = new Set(); for (const unit of units || []) { if (unitSet.has(unit[fieldName])) { return false; } unitSet.add(unit[fieldName]); } return true; }