( obj: TRecord, )
| 9 | }; |
| 10 | |
| 11 | export 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 | |
| 22 | const TRPC_HTTP_STATUS_ERROR_CODE = invert(TRPC_ERROR_CODE_HTTP_STATUS); |
| 23 |
no test coverage detected