MCPcopy Create free account
hub / github.com/pacexy/flow / group

Function group

apps/reader/src/utils.ts:13–22  ·  view source on GitHub ↗
(array: T[], getKey: (item: T) => string | number)

Source from the content-addressed store, hash-verified

11}
12
13export function group<T>(array: T[], getKey: (item: T) => string | number) {
14 const o: Record<string, T[]> = {}
15
16 array.forEach((item) => {
17 const key = getKey(item)
18 o[key] = [...(o[key] ?? []), item]
19 })
20
21 return o
22}
23
24export function copy(text: string) {
25 return navigator.clipboard.writeText(text)

Callers 2

AnnotationPaneFunction · 0.90
exportAnnotationsFunction · 0.90

Calls 1

forEachMethod · 0.45

Tested by

no test coverage detected