um-react/src/util/objects.ts

8 lines
205 B
TypeScript
Raw Normal View History

2023-06-03 13:09:11 +00:00
export function* enumObject<T>(obj: Record<string, T> | null | void): Generator<[string, T]> {
if (obj && typeof obj === 'object') {
for (const key in obj) {
yield [key, obj[key]];
}
}
}