Fixed getOwnEntries for arrays

This commit is contained in:
Kir_Antipov 2024-01-05 15:07:02 +00:00
parent 0ebd21131f
commit dfd4e9ac5b

View file

@ -173,7 +173,7 @@ export function getOwnEntries<K, V>(obj: KeyValueIterable<K, V> | Iterable<reado
return []; return [];
} }
if (isKeyValueIterable(obj)) { if (!Array.isArray(obj) && isKeyValueIterable(obj)) {
return obj.entries(); return obj.entries();
} }
@ -184,6 +184,10 @@ export function getOwnEntries<K, V>(obj: KeyValueIterable<K, V> | Iterable<reado
} }
} }
if (Array.isArray(obj)) {
return obj.entries() as Iterable<[K, V]>;
}
return Object.entries(obj) as Iterable<[K, V]>; return Object.entries(obj) as Iterable<[K, V]>;
} }