UNPKG

413 BJavaScriptView Raw
1export default function objType(obj) {
2 var type = Object.prototype.toString.call(obj).slice(8, -1);
3
4 if (type === 'Object' && typeof obj[Symbol.iterator] === 'function') {
5 return 'Iterable';
6 }
7
8 if (type === 'Custom' && obj.constructor !== Object && obj instanceof Object) {
9 // For projects implementing objects overriding `.prototype[Symbol.toStringTag]`
10 return 'Object';
11 }
12
13 return type;
14}
\No newline at end of file