File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,9 @@ export type Enhance<T, E extends Dict<any> | Dict<any>[]> = GetLength<ToArray<E>
1313
1414export const toArray = < T > ( a : MaybeArray < T > ) => Array . isArray ( a ) ? a : [ a ] ;
1515
16- export type CamelCase < T extends string > = T extends `${infer A } -${infer B } ${infer C } `
17- ? `${A } ${Capitalize < B > } ${CamelCase < C > } `
18- : T ;
19- export const camelCase = < T extends string > ( s : T ) : CamelCase < T > => s . replace ( / - ( [ a - z ] ) / g, ( _ , c ) => c . toUpperCase ( ) ) as CamelCase < T > ;
16+ // eslint-disable-next-line @so1ve/space-between-generic-and-paren
17+ export type CamelCase < T extends string > = ( T extends `${infer Prefix } -${infer Suffix } ` | `${infer Prefix } ${infer Suffix } ` ? `${Prefix } ${Capitalize < CamelCase < Suffix > > } ` : T ) ;
18+ export const camelCase = < T extends string > ( s : T ) : CamelCase < T > => s . replace ( / [ - _ ] ( \w ) / g, ( _ , c ) => c . toUpperCase ( ) ) as CamelCase < T > ;
2019
2120export type KebabCase < T extends string , A extends string = "" > = T extends `${infer F } ${infer R } `
2221 ? KebabCase < R , `${A } ${F extends Lowercase < F > ? "" : "-" } ${Lowercase < F > } `>
You can’t perform that action at this time.
0 commit comments