Skip to content

Commit 86fd44d

Browse files
Archmongerrmorshea
andauthored
better _hypen_to_camel_case
Co-authored-by: Ryan Morshead <[email protected]>
1 parent 63acce6 commit 86fd44d

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/idom/utils.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,7 @@ def _generate_vdom_children(
201201
)
202202

203203

204-
def _hypen_to_camel_case(css_key: str) -> str:
204+
def _hypen_to_camel_case(string: str) -> str:
205205
"""Convert a hypenated string to camelCase."""
206-
first_word, *subsequent_words = css_key.split("-")
207-
208-
return "".join(
209-
[
210-
# Lowercase the first word
211-
first_word.lower(),
212-
# Use map() to titlecase all subsequent words
213-
*map(str.title, subsequent_words),
214-
]
215-
)
206+
first, remainder = string.split("-", 1)
207+
return first.lower() + remainder.title().replace("-", "")

0 commit comments

Comments
 (0)