Skip to content

Commit f783023

Browse files
committed
fix: fixing the capitalCase
1 parent 3fb3539 commit f783023

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ npm run dev
2121

2222
Call up Raycast and search for CodeVar. Input the variable you want to translate, and press Enter to copy it to the clipboard. Alternatively, you can press Cmd + Enter to copy and paste it. Enjoy using CodeVar!
2323

24-
<img src="https://user-images.githubusercontent.com/15377484/226114870-ba00abf7-23d1-4e42-b703-396841427c2f.png" width="750px" />
24+
<img src="https://user-images.githubusercontent.com/15377484/226154935-4f1c0052-a8e2-45dc-9cd6-d97dfdf42993.png" width="750px" />
2525

2626
### License
27+
2728
CodeVar is licensed under the MIT License.

src/useQuery.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@ export async function queryVariableNames(content: string, signal?: AbortSignal):
4040
const content = (await response.json()) as ChatCompletion;
4141
let result: Result[] = [];
4242
try {
43-
const text = (content?.choices?.[0]?.message?.content || "").replace(/\n|\./g, "");
44-
result = CASES.map((type) => ({ value: changeCase[type](text), type }));
43+
const text = (content?.choices?.[0]?.message?.content || "").replace(/\n/g, "").replace(/\./g, "").trim();
44+
result = CASES.map((type) => {
45+
if (type === "capitalCase") {
46+
return { value: changeCase[type](text.replace(/ /g, "")), type };
47+
}
48+
return { value: changeCase[type](text), type };
49+
});
4550
} catch (error) {
4651
result = [];
4752
}

0 commit comments

Comments
 (0)