Code & Deploy
siGit Code
Git Hosting
Toggle menu
siGit Code
Git Hosting
Sign in
Sign in
@davoodmehraban89
/
medusa
Fork
0
medusa
/
packages
/
core
/
utils
/
src
/
common
/
to-camel-case.ts
Code
Commits
Issues
Pulls
Cloud Agent
CICD
security/codeql-dependabot-gitleaks
automation/medusa-upstream-review
main
project/medusa-foundation-audit
security/codeql-dependabot-gitleaks
ts
7 lines
230 Bytes
Copy permalink
Copy
Raw
1
export
function
toCamelCase
(
str
:
string
):
string
{
2
return
/^
([
a-zA-Z
][
a-zA-Z0-9
]
*
)(([
A-Z
][
a-z0-9
]
+
)
+
)
$/
.
test
(
str
)
3
?
str
4
:
str
5
.
toLowerCase
()
6
.
replace
(
/
[^
a-zA-Z0-9
]
+
(
.
)
/g
,
(
_
,
chr
)
=>
chr
.
toUpperCase
())
7
}