1 | import type {SplitIncludingDelimiters} from './delimiter-case';
|
2 | import type {SnakeCase} from './snake-case';
|
3 | import type {Includes} from './includes';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | type IsScreamingSnakeCase<Value extends string> = Value extends Uppercase<Value>
|
9 | ? Includes<SplitIncludingDelimiters<Lowercase<Value>, '_'>, '_'> extends true
|
10 | ? true
|
11 | : false
|
12 | : false;
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | export type ScreamingSnakeCase<Value> = Value extends string
|
30 | ? IsScreamingSnakeCase<Value> extends true
|
31 | ? Value
|
32 | : Uppercase<SnakeCase<Value>>
|
33 | : Value;
|