UNPKG

@sapphire/utilities

Version:
43 lines (41 loc) 1.55 kB
/** * The variants that will not strictly follow the `toTitleCase` algorithm * and will instead return the value matched with the key. * * This table lists how certain terms are converted. * Any terms not included are converted to regular `Titlecase`. * | Term | Converted To | * |:---------------- |:---------------- | * | textchannel | TextChannel | * | voicechannel | VoiceChannel | * | categorychannel | CategoryChannel | * | guildmember | GuildMember | */ declare const toTitleCaseDiscordJsVariants: Record<string, string>; /** * Converts a string to Title Case * * @description This is designed to also ensure common Discord PascalCased strings * are put in their TitleCase {@link toTitleCaseDiscordJsVariants}. * * You can also provide your own variants to merge with the {@link toTitleCaseDiscordJsVariants} for * your own functionality use. * * @param str The string to title case * @param options The options to use when converting the string */ declare function toTitleCase(str: string, options?: ToTitleCaseOptions): string; /** * The options to use when converting a string to title case */ interface ToTitleCaseOptions { /** * The optional additional variants to use when converting the string */ additionalVariants?: Record<string, string>; /** * Whether to convert the string to title case in a case sensitive manner. */ caseSensitive?: boolean; } export { type ToTitleCaseOptions, toTitleCase, toTitleCaseDiscordJsVariants };