UNPKG
@lucide/helpers
Version:
latest (1.0.0)
1.0.0
A internal used package with helpers.
@lucide/helpers
/
src
/
toCamelCase.mjs
11 lines
(10 loc)
•
260 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
/** * Converts string to CamelCase * *
@param
{
string
}
string
*
@returns
{
string
} A camelized string */
export
const
toCamelCase
= (
string
) =>
string
.
replace
(
/^([A-Z])|[\s-_]+(\w)/g
,
(
match, p1, p2
) =>
p2 ? p2.
toUpperCase
() : p1.
toLowerCase
(), );