Skip to content

Commit 04f15f6

Browse files
committed
arrays shouldn't be treated as an iterable
1 parent c76f755 commit 04f15f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/react/JSONTree/obj-type.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
export default function(obj) {
2-
if (obj !== null && typeof obj === 'object' && typeof obj[Symbol.iterator] === 'function') {
2+
if (obj !== null && typeof obj === 'object' && !Array.isArray(obj) &&
3+
typeof obj[Symbol.iterator] === 'function'
4+
) {
35
return 'Iterable';
46
}
57
return Object.prototype.toString.call(obj).slice(8, -1);

0 commit comments

Comments
 (0)