MCPcopy Index your code
hub / github.com/OpenPipe/OpenPipe / invert

Function invert

app/src/server/utils/trpcStatusCodes.ts:11–20  ·  view source on GitHub ↗
(
  obj: TRecord,
)

Source from the content-addressed store, hash-verified

9};
10
11export function invert<TRecord extends Record<PropertyKey, PropertyKey>>(
12 obj: TRecord,
13): Invert<TRecord> {
14 const newObj = Object.create(null);
15 for (const key in obj) {
16 const v = obj[key];
17 newObj[v] = key;
18 }
19 return newObj as Invert<TRecord>;
20}
21
22const TRPC_HTTP_STATUS_ERROR_CODE = invert(TRPC_ERROR_CODE_HTTP_STATUS);
23

Callers 1

trpcStatusCodes.tsFile · 0.85

Calls 1

createMethod · 0.45

Tested by

no test coverage detected