File tree Expand file tree Collapse file tree
packages/cli-kit/src/public/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,24 +161,25 @@ const SAFE_RANDOM_CREATIVE_NOUNS = [
161161
162162export type RandomNameFamily = 'business' | 'creative'
163163
164+ const NAME_FAMILIES : Record < RandomNameFamily , { adjectives : string [ ] ; nouns : string [ ] } > = {
165+ business : {
166+ adjectives : SAFE_RANDOM_BUSINESS_ADJECTIVES ,
167+ nouns : SAFE_RANDOM_BUSINESS_NOUNS ,
168+ } ,
169+ creative : {
170+ adjectives : SAFE_RANDOM_CREATIVE_ADJECTIVES ,
171+ nouns : SAFE_RANDOM_CREATIVE_NOUNS ,
172+ } ,
173+ }
174+
164175/**
165176 * Generates a random name by combining an adjective and noun.
166177 *
167178 * @param family - Theme to use for the random name (business or creative).
168179 * @returns A random name generated by combining an adjective and noun.
169180 */
170181export function getRandomName ( family : RandomNameFamily = 'business' ) : string {
171- const mapping = {
172- business : {
173- adjectives : SAFE_RANDOM_BUSINESS_ADJECTIVES ,
174- nouns : SAFE_RANDOM_BUSINESS_NOUNS ,
175- } ,
176- creative : {
177- adjectives : SAFE_RANDOM_CREATIVE_ADJECTIVES ,
178- nouns : SAFE_RANDOM_CREATIVE_NOUNS ,
179- } ,
180- }
181- return `${ takeRandomFromArray ( mapping [ family ] . adjectives ) } -${ takeRandomFromArray ( mapping [ family ] . nouns ) } `
182+ return `${ takeRandomFromArray ( NAME_FAMILIES [ family ] . adjectives ) } -${ takeRandomFromArray ( NAME_FAMILIES [ family ] . nouns ) } `
182183}
183184
184185/**
You can’t perform that action at this time.
0 commit comments