mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2024-11-27 20:12:17 +00:00
10 lines
240 B
TypeScript
10 lines
240 B
TypeScript
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;
|