diff options
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()); +}; |
