mirror of
https://github.com/fmhy/edit.git
synced 2025-07-30 07:42:18 +10:00
hello world, again
This commit is contained in:
commit
f479740dd1
133 changed files with 32895 additions and 0 deletions
13
docs/.vitepress/utils.ts
Normal file
13
docs/.vitepress/utils.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
export function groupBy<T, K extends keyof any>(
|
||||
arr: T[],
|
||||
key: (i: T) => K
|
||||
): Record<K, T[]> {
|
||||
return arr.reduce(
|
||||
(groups, item) => {
|
||||
// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
|
||||
;(groups[key(item)] ||= []).push(item)
|
||||
return groups
|
||||
},
|
||||
{} as Record<K, T[]>
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue