diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-19 19:46:24 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-19 19:46:24 +0200 |
| commit | bbd63400f94b43fde04449e0c71d14763d893e6a (patch) | |
| tree | 057055dce19fc71c7c2e2fa05b691144224dfbd0 /src/utils/helpers/strings.ts | |
| parent | 806004ab79ac4e1cb49cef93ab3f35a08c5c82b5 (diff) | |
refactor: rewrite Prism hooks and providers
It avoid some hydratation errors on project pages (not in article
however) and the hooks are now reusable.
Diffstat (limited to 'src/utils/helpers/strings.ts')
| -rw-r--r-- | src/utils/helpers/strings.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils/helpers/strings.ts b/src/utils/helpers/strings.ts index 5d90161..1af0ca2 100644 --- a/src/utils/helpers/strings.ts +++ b/src/utils/helpers/strings.ts @@ -27,3 +27,13 @@ export const slugify = (text: string): string => { export const capitalize = (text: string): string => { return text.replace(/^\w/, (firstLetter) => firstLetter.toUpperCase()); }; + +/** + * Convert a text from kebab case (foo-bar) to camel case (fooBar). + * + * @param {string} text - A text to transform. + * @returns {string} The text in camel case. + */ +export const fromKebabCaseToCamelCase = (text: string): string => { + return text.replace(/-./g, (x) => x[1].toUpperCase()); +}; |
