mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-22 04:21:32 +02:00
8 lines
201 B
TypeScript
8 lines
201 B
TypeScript
export function invert<T extends Record<PropertyKey, PropertyKey>>(obj: T) {
|
|
const result = {} as Record<T[keyof T], keyof T>;
|
|
for (const key in obj) {
|
|
result[obj[key]] = key;
|
|
}
|
|
return result;
|
|
}
|