posts setup

This commit is contained in:
taskylizard
2023-12-31 06:57:10 +00:00
parent 8f457fa166
commit 5ae23bea33
14 changed files with 528 additions and 229 deletions

9
.vitepress/utils.ts Normal file
View File

@@ -0,0 +1,9 @@
export function groupBy<T, K extends keyof any>(arr: T[], key: (i: T) => K): Record<K, T[]> {
return arr.reduce(
(groups, item) => {
(groups[key(item)] ||= []).push(item);
return groups;
},
{} as Record<K, T[]>,
);
}