We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bfe0e05 commit e56e403Copy full SHA for e56e403
src/utils/__tests__/to-camel.test.ts
@@ -7,6 +7,7 @@ describe('toCamel', () => {
7
expect(toCamel('toCamel')).toBe('toCamel')
8
expect(toCamel('TO_CAMEL')).toBe('toCamel')
9
expect(toCamel('TO-CAMEL')).toBe('toCamel')
10
+ expect(toCamel('ToCamel')).toBe('toCamel')
11
expect(toCamel('TO CAMEL')).toBe('toCamel')
12
expect(toCamel('to_Camel')).toBe('toCamel')
13
expect(toCamel('to camel')).toBe('toCamel')
src/utils/to-camel.ts
@@ -10,6 +10,7 @@ export function toCamel(str: string): string {
}
return str
.split(/([A-Z][a-z]+)/)
+ .filter(Boolean)
14
.map((word, index) => {
15
if (index === 0) return word.toLowerCase()
16
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
0 commit comments