um-react/src/util/objects.ts

10 lines
240 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]];
}
}
}
export const { hasOwn } = Object;