mirror of
				https://github.com/reduxjs/redux-devtools.git
				synced 2025-11-04 01:47:25 +03:00 
			
		
		
		
	safer type checking for iterable structures
This commit is contained in:
		
							parent
							
								
									56de89c440
								
							
						
					
					
						commit
						c76f755863
					
				| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
export default function(obj) {
 | 
					export default function(obj) {
 | 
				
			||||||
  const type = Object.prototype.toString.call(obj).slice(8, -1);
 | 
					  if (obj !== null && typeof obj === 'object' && typeof obj[Symbol.iterator] === 'function') {
 | 
				
			||||||
  if (type === 'Object' && typeof obj[Symbol.iterator] === 'function') {
 | 
					 | 
				
			||||||
    return 'Iterable';
 | 
					    return 'Iterable';
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return type;
 | 
					  return Object.prototype.toString.call(obj).slice(8, -1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user