UNPKG

reddit-style-username-generator

Version:

A utility for generating and storing unique username combinations in Redis. This package reads usernames from a file, generates combinations with specified colors and nouns, and stores them in a Redis set.

29 lines (24 loc) 1.26 kB
declare function capitalizeFirstLetter(word: string): string; declare function getRandomNumber(min?: number, max?: number): number; declare function generateUsername(separator?: string, enableColor?: boolean, suffixNumber?: number): string; declare function generateCombinationsToFile(outputFilePath: string, randomRange: number[]): void; declare class HydrateUsernamesInRedis { private redis; private clientType; constructor(redisInstance: any); private detectRedisClient; storeUsernamesFromFile(redisKey: string, batchSize?: number): Promise<void>; generateAndStoreCombinations(filePath: string, redisKey: string): Promise<void>; readAndStoreUsernamesFromStream(filePath: string, redisKey: string): Promise<void>; addUsernamesToRedis(redisKey: string, usernames: string[]): Promise<void>; getRandomUsernameFromRedis(redisKey: string, removeSelectedUsername?: boolean): Promise<any>; quitRedis(): Promise<void>; } type Style = 'lowerCase' | 'upperCase' | 'capital'; interface Config { dictionaries: string[][]; separator?: string; length?: number; style?: Style; } export { type Config, HydrateUsernamesInRedis, capitalizeFirstLetter, generateCombinationsToFile, generateUsername, getRandomNumber };