Allow for . & , in camelCase (#1231)

This commit is contained in:
Jaco
2021-11-22 16:41:50 +02:00
committed by GitHub
parent a2d9538b31
commit cdd2d9ace5
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -8,7 +8,7 @@ import { performanceJs } from '../../test/performance';
import { arrayRange } from '../array';
import { stringCamelCase, stringUpperFirst } from '.';
const SEPS = [' ', '_', '-'];
const SEPS = [' ', '_', '-', '.', ','];
const randomWords = arrayRange(256).map((): [string] => {
let result = '';
@@ -33,14 +33,14 @@ const randomWords = arrayRange(256).map((): [string] => {
describe('stringCamelCase', (): void => {
it('works correctly', (): void => {
expect(
stringCamelCase('Snake_case-Something spaced')
stringCamelCase('Snake_case-...Something spaced')
).toBe('snakeCaseSomethingSpaced');
});
it('works correctly for String (class', (): void => {
expect(
stringCamelCase(String('Foo_bar-baz---test-_ spaced'))
).toBe('fooBarBazTestSpaced');
stringCamelCase(String('Foo_bar-baz---test-_ spaced....Extra'))
).toBe('fooBarBazTestSpacedExtra');
});
performanceJs('stringCamelCase', 64000, randomWords, stringCamelCase);
+1 -1
View File
@@ -3,7 +3,7 @@
import type { AnyString } from '../types';
const RE_WHITE = /[-_ ]+/g;
const RE_WHITE = /[-_., ]+/g;
const RE_WORDS = /(?:^\w|[A-Z]|\b\w)/g;
const RE_JOIN = /\s/g;