Skip to content

Commit e56e403

Browse files
committed
Fix toCamel issue
1 parent bfe0e05 commit e56e403

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/utils/__tests__/to-camel.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ describe('toCamel', () => {
77
expect(toCamel('toCamel')).toBe('toCamel')
88
expect(toCamel('TO_CAMEL')).toBe('toCamel')
99
expect(toCamel('TO-CAMEL')).toBe('toCamel')
10+
expect(toCamel('ToCamel')).toBe('toCamel')
1011
expect(toCamel('TO CAMEL')).toBe('toCamel')
1112
expect(toCamel('to_Camel')).toBe('toCamel')
1213
expect(toCamel('to camel')).toBe('toCamel')

src/utils/to-camel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export function toCamel(str: string): string {
1010
}
1111
return str
1212
.split(/([A-Z][a-z]+)/)
13+
.filter(Boolean)
1314
.map((word, index) => {
1415
if (index === 0) return word.toLowerCase()
1516
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()

0 commit comments

Comments
 (0)