This commit is contained in:
Jaco
2021-11-30 07:12:55 +02:00
committed by GitHub
parent 5d1dd0dd27
commit 2e520c933a
18 changed files with 84 additions and 64 deletions
@@ -49,5 +49,17 @@ describe('stringCamelCase', (): void => {
).toEqual('dedupKeyPrefix');
});
it('adjusts with leading _', (): void => {
expect(
stringCamelCase('_reserved')
).toEqual('reserved');
});
it('adjusts with minimal chars per part', (): void => {
expect(
stringCamelCase('_a_b_c_def')
).toEqual('aBCDef');
});
performance('stringCamelCase', 64000, randomWords, stringCamelCase);
});
+1
View File
@@ -18,6 +18,7 @@ function converter (fn: (w: string, i: number) => string): (value: AnyString) =>
value
.toString()
.replace(/[-_., ]+/g, ' ')
.trim()
.split(' ')
.map((w, i) =>
fn(w[0], i) + (