Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .jules/refactor.md
Empty file.
23 changes: 12 additions & 11 deletions packages/cli-kit/src/public/common/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,24 +161,25 @@ const SAFE_RANDOM_CREATIVE_NOUNS = [

export type RandomNameFamily = 'business' | 'creative'

const NAME_FAMILIES: Record<RandomNameFamily, {adjectives: string[]; nouns: string[]}> = {
business: {
adjectives: SAFE_RANDOM_BUSINESS_ADJECTIVES,
nouns: SAFE_RANDOM_BUSINESS_NOUNS,
},
creative: {
adjectives: SAFE_RANDOM_CREATIVE_ADJECTIVES,
nouns: SAFE_RANDOM_CREATIVE_NOUNS,
},
}

/**
* Generates a random name by combining an adjective and noun.
*
* @param family - Theme to use for the random name (business or creative).
* @returns A random name generated by combining an adjective and noun.
*/
export function getRandomName(family: RandomNameFamily = 'business'): string {
const mapping = {
business: {
adjectives: SAFE_RANDOM_BUSINESS_ADJECTIVES,
nouns: SAFE_RANDOM_BUSINESS_NOUNS,
},
creative: {
adjectives: SAFE_RANDOM_CREATIVE_ADJECTIVES,
nouns: SAFE_RANDOM_CREATIVE_NOUNS,
},
}
return `${takeRandomFromArray(mapping[family].adjectives)}-${takeRandomFromArray(mapping[family].nouns)}`
return `${takeRandomFromArray(NAME_FAMILIES[family].adjectives)}-${takeRandomFromArray(NAME_FAMILIES[family].nouns)}`
}

/**
Expand Down
Loading