From bbd63400f94b43fde04449e0c71d14763d893e6a Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Thu, 19 May 2022 19:46:24 +0200 Subject: refactor: rewrite Prism hooks and providers It avoid some hydratation errors on project pages (not in article however) and the hooks are now reusable. --- src/utils/helpers/strings.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/utils/helpers') 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()); +}; -- cgit v1.2.3