21 lines
417 B
TypeScript
21 lines
417 B
TypeScript
import {
|
|
adjectives,
|
|
animals,
|
|
colors,
|
|
type Config,
|
|
uniqueNamesGenerator
|
|
} from 'unique-names-generator';
|
|
|
|
const nameConfig: Config = {
|
|
dictionaries: [adjectives, colors, animals],
|
|
separator: ' ',
|
|
style: 'capital'
|
|
};
|
|
export function getRandomName() {
|
|
return uniqueNamesGenerator(nameConfig);
|
|
}
|
|
|
|
export function getRandomUsername() {
|
|
return uniqueNamesGenerator({ ...nameConfig, separator: '' });
|
|
}
|