-
Notifications
You must be signed in to change notification settings - Fork 1
/
checkCategory.ts
43 lines (42 loc) · 1.15 KB
/
checkCategory.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import * as Articles from "contentlayer/generated";
import type { DocumentTypes } from ".contentlayer/generated/types";
export const checkCategory = (
category: string,
sortDocsOrgetArticle: (docs: DocumentTypes[]) => void
) => {
switch (category) {
case "js":
sortDocsOrgetArticle(Articles.allJs);
break;
case "types":
sortDocsOrgetArticle(Articles.allTypes);
break;
case "next":
sortDocsOrgetArticle(Articles.allNexts);
break;
case "react":
sortDocsOrgetArticle(Articles.allReacts);
break;
case "other":
sortDocsOrgetArticle(Articles.allOthers);
break;
case "algorithm":
sortDocsOrgetArticle(Articles.allAlgorithms);
break;
case "backend":
sortDocsOrgetArticle(Articles.allBackEnds);
break;
case "db":
sortDocsOrgetArticle(Articles.allDataBases);
break;
case "server":
sortDocsOrgetArticle(Articles.allServers);
break;
case "git":
sortDocsOrgetArticle(Articles.allGits);
break;
case "article":
sortDocsOrgetArticle(Articles.allArticles);
break;
}
};