MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / toObject

Function toObject

packages/utilities/src/object.ts:11–14  ·  view source on GitHub ↗
(
  arr: T[],
  key: K
)

Source from the content-addressed store, hash-verified

9}
10
11export const toObject = <T extends Record<string, any>, K extends keyof T>(
12 arr: T[],
13 key: K
14): Record<string, T> => arr.reduce((a, b) => ({ ...a, [b[key]]: b }), {});
15
16export function sortBySentAtAsc(a: { sentAt: bigint }, b: { sentAt: bigint }) {
17 return Number(a.sentAt) - Number(b.sentAt);

Callers 1

findUsersFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected