UNPKG

484 BJavaScriptView Raw
1import { split, toLower, toUpper } from "no-case";
2export function pascalCase(input, options) {
3 const lower = toLower(options?.locale);
4 const upper = toUpper(options?.locale);
5 return split(input, options)
6 .map((word, index) => {
7 const char0 = word[0];
8 const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
9 return initial + lower(word.slice(1));
10 })
11 .join("");
12}
13//# sourceMappingURL=index.js.map
\No newline at end of file