Skip to content

Commit 0b53876

Browse files
committed
Underscores to pascal case
1 parent 252588f commit 0b53876

File tree

6 files changed

+69
-69
lines changed

6 files changed

+69
-69
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -232,22 +232,22 @@ __replacerSlot__; // LivesDownByTheRiver
232232
You may also specify the case using an underscores-only syntax:
233233

234234
```js
235-
__replacerSlot__noCase__; // Lives down BY the River
236-
__replacerSlot__camelCase__; // livesDownByTheRiver
237-
__replacerSlot__constantCase__; // LIVES_DOWN_BY_THE_RIVER
238-
__replacerSlot__dotCase__; // lives.down.by.the.river
239-
__replacerSlot__kebabCase__; // lives-down-by-the-river
240-
__replacerSlot__lowerCase__; // livesdownbytheriver
241-
__replacerSlot__pascalCase__; // LivesDownByTheRiver
242-
__replacerSlot__pathCase__; // lives/down/by/the/river
243-
__replacerSlot__sentenceCase__; // Lives down by the river
244-
__replacerSlot__snakeCase__; // lives_down_by_the_river
245-
__replacerSlot__titleCase__; // Lives Down By The River
235+
__replacerSlot__NoCase__; // Lives down BY the River
236+
__replacerSlot__CamelCase__; // livesDownByTheRiver
237+
__replacerSlot__ConstantCase__; // LIVES_DOWN_BY_THE_RIVER
238+
__replacerSlot__DotCase__; // lives.down.by.the.river
239+
__replacerSlot__KebabCase__; // lives-down-by-the-river
240+
__replacerSlot__LowerCase__; // livesdownbytheriver
241+
__replacerSlot__PascalCase__; // LivesDownByTheRiver
242+
__replacerSlot__PathCase__; // lives/down/by/the/river
243+
__replacerSlot__SentenceCase__; // Lives down by the river
244+
__replacerSlot__SnakeCase__; // lives_down_by_the_river
245+
__replacerSlot__TitleCase__; // Lives Down By The River
246246
```
247247

248248
One Rule: no spaces between the [Replacer Slots](#replacer-slots-or-ireplacerslotquestion) and [Case Converters](#case-converters). If there is a space, [Case Converters](#case-converters) will not work.
249249

250-
- :white_check_mark: `__name__(camelCase)` OR `__name__camelCase__`
250+
- :white_check_mark: `__name__(camelCase)` OR `__name__CamelCase__`
251251
- :warning: `__name__ (camelCase)`
252252

253253
## Batch Usage
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// src/__scope__CamelCase__/__resourceName__(pascalCase).ts
2+
import { __resourceName__SnakeCase___data } from "./__resourceName__PascalCase__Data"
3+
4+
console.assert(__resourceName__SnakeCase___data.key === "__resourceName__(snakeCase)");
5+
6+
export const __resourceName__ConstantCase___KEY = __resourceName__SnakeCase___data.key;
7+
type __resourceName__PascalCase__Data = typeof __resourceName__SnakeCase___data
8+
9+
/**
10+
*
11+
*/
12+
const fetchData = (_key: "__resourceName__(snakeCase)"): __resourceName__PascalCase__Data => {
13+
// Implement fetch logic here
14+
const result: __resourceName__PascalCase__Data["result"] = {}
15+
16+
return {
17+
key: __resourceName__ConstantCase___KEY,
18+
result,
19+
}
20+
};
21+
22+
/**
23+
* The __resourceName__(titleCase) fetcher
24+
*/
25+
export const get__resourceName__ = async (): Promise<__resourceName__PascalCase__Data> => {
26+
const __resourceName__CamelCase__ = fetchData(__resourceName__SnakeCase___data.key);
27+
return __resourceName__CamelCase__;
28+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// src/__scope__CamelCase__/__resourceName__(pascalCase)Data.ts
2+
export const __resourceName__SnakeCase___data = {
3+
key: "__resourceName__(snakeCase)",
4+
result: {
5+
// Add values here
6+
}
7+
} as const

examples/tools/templates/misc/__resourceName__pascalCase__.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

examples/tools/templates/misc/__resourceName__pascalCase__Data.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/constants/CaseConverterEnum.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ enum CaseConverterEnum {
55
*
66
* ```
77
* // If you entered "Lives down BY the River" for __replacerSlot__
8-
* __replacerSlot__(noCase) OR __replacerSlot__noCase__
8+
* __replacerSlot__(noCase) OR __replacerSlot__NoCase__
99
*
1010
* // It would output to:
1111
* Lives down BY the River
@@ -18,13 +18,13 @@ enum CaseConverterEnum {
1818
* ```
1919
*/
2020
None = '(noCase)',
21-
NoneUnderscore = 'noCase__',
21+
NoneUnderscore = 'NoCase__',
2222
/**
2323
* [Case Converter](../index.html#case-converters) that converts [Replacer Slots](../index.html#replacer-slots) to camel case.
2424
*
2525
* ```
2626
* // If you entered "Lives down BY the River" for __replacerSlot__
27-
* __replacerSlot__(camelCase) OR __replacerSlot__camelCase__
27+
* __replacerSlot__(camelCase) OR __replacerSlot__CamelCase__
2828
*
2929
* // It would output to:
3030
* livesDownByTheRiver
@@ -37,13 +37,13 @@ enum CaseConverterEnum {
3737
* ```
3838
*/
3939
CamelCase = '(camelCase)',
40-
CamelCaseUnderscore = 'camelCase__',
40+
CamelCaseUnderscore = 'CamelCase__',
4141
/**
4242
* [Case Converter](../index.html#case-converters) that converts [Replacer Slots](../index.html#replacer-slots) to constant case.
4343
*
4444
* ```
4545
* // If you entered "Lives down BY the River" for __replacerSlot__
46-
* __replacerSlot__(constantCase) OR __replacerSlot__constantCase__
46+
* __replacerSlot__(constantCase) OR __replacerSlot__ConstantCase__
4747
*
4848
* // It would output to:
4949
* LIVES_DOWN_BY_THE_RIVER
@@ -56,13 +56,13 @@ enum CaseConverterEnum {
5656
* ```
5757
*/
5858
ConstantCase = '(constantCase)',
59-
ConstantCaseUnderscore = 'constantCase__',
59+
ConstantCaseUnderscore = 'ConstantCase__',
6060
/**
6161
* [Case Converter](../index.html#case-converters) that converts [Replacer Slots](../index.html#replacer-slots) to dot case.
6262
*
6363
* ```
6464
* // If you entered "Lives down BY the River" for __replacerSlot__
65-
* __replacerSlot__(dotCase) OR __replacerSlot__dotCase__
65+
* __replacerSlot__(dotCase) OR __replacerSlot__DotCase__
6666
*
6767
* // It would output to:
6868
* lives.down.by.the.river
@@ -75,13 +75,13 @@ enum CaseConverterEnum {
7575
* ```
7676
*/
7777
DotCase = '(dotCase)',
78-
DotCaseUnderscore = 'dotCase__',
78+
DotCaseUnderscore = 'DotCase__',
7979
/**
8080
* [Case Converter](../index.html#case-converters) that converts [Replacer Slots](../index.html#replacer-slots) to kebab case.
8181
*
8282
* ```
8383
* // If you entered "Lives down BY the River" for __replacerSlot__
84-
* __replacerSlot__(kebabCase) OR __replacerSlot__kebabCase__
84+
* __replacerSlot__(kebabCase) OR __replacerSlot__KebabCase__
8585
*
8686
* // It would output to:
8787
* lives-down-by-the-river
@@ -94,13 +94,13 @@ enum CaseConverterEnum {
9494
* ```
9595
*/
9696
KebabCase = '(kebabCase)',
97-
KebabCaseUnderscore = 'kebabCase__',
97+
KebabCaseUnderscore = 'KebabCase__',
9898
/**
9999
* [Case Converter](../index.html#case-converters) that converts [Replacer Slots](../index.html#replacer-slots) to all lower case.
100100
*
101101
* ```
102102
* // If you entered "Lives down BY the River" for __replacerSlot__
103-
* __replacerSlot__(lowerCase) OR __replacerSlot__lowerCase__
103+
* __replacerSlot__(lowerCase) OR __replacerSlot__LowerCase__
104104
*
105105
* // It would output to:
106106
* livesdownbytheriver
@@ -113,13 +113,13 @@ enum CaseConverterEnum {
113113
* ```
114114
*/
115115
LowerCase = '(lowerCase)',
116-
LowerCaseUnderscore = 'lowerCase__',
116+
LowerCaseUnderscore = 'LowerCase__',
117117
/**
118118
* [Case Converter](../index.html#case-converters) that converts [Replacer Slots](../index.html#replacer-slots) to pacal case.
119119
*
120120
* ```
121121
* // If you entered "Lives down BY the River" for __replacerSlot__
122-
* __replacerSlot__(pascalCase) OR __replacerSlot__pascalCase__
122+
* __replacerSlot__(pascalCase) OR __replacerSlot__PascalCase__
123123
*
124124
* // It would output to:
125125
* LivesDownByTheRiver
@@ -132,13 +132,13 @@ enum CaseConverterEnum {
132132
* ```
133133
*/
134134
PascalCase = '(pascalCase)',
135-
PascalCaseUnderscore = 'pascalCase__',
135+
PascalCaseUnderscore = 'PascalCase__',
136136
/**
137137
* [Case Converter](../index.html#case-converters) that converts [Replacer Slots](../index.html#replacer-slots) to path case.
138138
*
139139
* ```
140140
* // If you entered "Lives down BY the River" for __replacerSlot__
141-
* __replacerSlot__(pathCase) OR __replacerSlot__pathCase__
141+
* __replacerSlot__(pathCase) OR __replacerSlot__PathCase__
142142
*
143143
* // It would output to:
144144
* lives/down/by/the/river
@@ -151,13 +151,13 @@ enum CaseConverterEnum {
151151
* ```
152152
*/
153153
PathCase = '(pathCase)',
154-
PathCaseUnderscore = 'pathCase__',
154+
PathCaseUnderscore = 'PathCase__',
155155
/**
156156
* [Case Converter](../index.html#case-converters) that converts [Replacer Slots](../index.html#replacer-slots) to sentence case.
157157
*
158158
* ```
159159
* // If you entered "Lives down BY the River" for __replacerSlot__
160-
* __replacerSlot__(sentenceCase) OR __replacerSlot__sentenceCase__
160+
* __replacerSlot__(sentenceCase) OR __replacerSlot__SentenceCase__
161161
*
162162
* // It would output to:
163163
* Lives down by the river
@@ -170,13 +170,13 @@ enum CaseConverterEnum {
170170
* ```
171171
*/
172172
SentenceCase = '(sentenceCase)',
173-
SentenceCaseUnderscore = 'sentenceCase__',
173+
SentenceCaseUnderscore = 'SentenceCase__',
174174
/**
175175
* [Case Converter](../index.html#case-converters) that converts [Replacer Slots](../index.html#replacer-slots) to snake case.
176176
*
177177
* ```
178178
* // If you entered "Lives down BY the River" for __replacerSlot__
179-
* __replacerSlot__(snakeCase) OR __replacerSlot__snakeCase__
179+
* __replacerSlot__(snakeCase) OR __replacerSlot__SnakeCase__
180180
*
181181
* // It would output to:
182182
* lives_down_by_the_river
@@ -189,13 +189,13 @@ enum CaseConverterEnum {
189189
* ```
190190
*/
191191
SnakeCase = '(snakeCase)',
192-
SnakeCaseUnderscore = 'snakeCase__',
192+
SnakeCaseUnderscore = 'SnakeCase__',
193193
/**
194194
* [Case Converter](../index.html#case-converters) that converts [Replacer Slots](../index.html#replacer-slots) to title case.
195195
*
196196
* ```
197197
* // If you entered "Lives down BY the River" for __replacerSlot__
198-
* __replacerSlot__(titleCase) OR __replacerSlot__titleCase__
198+
* __replacerSlot__(titleCase) OR __replacerSlot__TitleCase__
199199
*
200200
* // It would output to:
201201
* Lives Down By The River
@@ -208,7 +208,7 @@ enum CaseConverterEnum {
208208
* ```
209209
*/
210210
TitleCase = '(titleCase)',
211-
TitleCaseUnderscore = 'titleCase__',
211+
TitleCaseUnderscore = 'TitleCase__',
212212
}
213213

214214
export default CaseConverterEnum;

0 commit comments

Comments
 (0)