diff options
Diffstat (limited to 'node_modules/@sapphire/utilities/dist/lib/toTitleCase.js')
-rw-r--r-- | node_modules/@sapphire/utilities/dist/lib/toTitleCase.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/node_modules/@sapphire/utilities/dist/lib/toTitleCase.js b/node_modules/@sapphire/utilities/dist/lib/toTitleCase.js new file mode 100644 index 0000000..9717824 --- /dev/null +++ b/node_modules/@sapphire/utilities/dist/lib/toTitleCase.js @@ -0,0 +1,36 @@ +'use strict'; + +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/lib/toTitleCase.ts +var TO_TITLE_CASE = /[A-Za-zÀ-ÖØ-öø-ÿ]\S*/g; +var baseVariants = { + textchannel: "TextChannel", + voicechannel: "VoiceChannel", + categorychannel: "CategoryChannel", + guildmember: "GuildMember" +}; +function toTitleCase(str, options = {}) { + const { additionalVariants = {}, caseSensitive } = options; + const titleCaseVariants = { + ...baseVariants, + ...caseSensitive ? additionalVariants : Object.entries(additionalVariants).reduce( + (variants, [key, variant]) => ({ ...variants, [key.toLowerCase()]: variant }), + {} + ) + }; + return str.replace( + TO_TITLE_CASE, + (txt) => { + var _a; + return (_a = titleCaseVariants[caseSensitive ? txt : txt.toLowerCase()]) != null ? _a : txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase(); + } + ); +} +__name(toTitleCase, "toTitleCase"); + +exports.baseVariants = baseVariants; +exports.toTitleCase = toTitleCase; +//# sourceMappingURL=out.js.map +//# sourceMappingURL=toTitleCase.js.map
\ No newline at end of file |