arrays shouldn't be treated as an iterable

This commit is contained in:
FredyC 2015-08-22 06:13:04 +02:00
parent c76f755863
commit 04f15f6d4d

View File

@ -1,5 +1,7 @@
export default function(obj) { export default function(obj) {
if (obj !== null && typeof obj === 'object' && typeof obj[Symbol.iterator] === 'function') { if (obj !== null && typeof obj === 'object' && !Array.isArray(obj) &&
typeof obj[Symbol.iterator] === 'function'
) {
return 'Iterable'; return 'Iterable';
} }
return Object.prototype.toString.call(obj).slice(8, -1); return Object.prototype.toString.call(obj).slice(8, -1);