Every line of 'typeof undefined' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
39 function typeOf(object) { 40 if (typeof object === 'object' && object !== null) { 41 var $$typeof = object.$$typeof; 42 43 switch ($$typeof) { 44 case REACT_ELEMENT_TYPE: 45 var type = object.type; 46 47 switch (type) { 48 case REACT_ASYNC_MODE_TYPE: 49 case REACT_FRAGMENT_TYPE: 50 case REACT_PROFILER_TYPE: 51 case REACT_STRICT_MODE_TYPE: 52 return type; 53 default: 54 var $$typeofType = type && type.$$typeof; 55 56 switch ($$typeofType) { 57 case REACT_CONTEXT_TYPE: 58 case REACT_FORWARD_REF_TYPE: 59 case REACT_PROVIDER_TYPE: 60 return $$typeofType; 61 default: 62 return $$typeof; 63 } 64 } 65 case REACT_PORTAL_TYPE: 66 return $$typeof; 67 } 68 } 69 70 return undefined; 71 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
14 function typeOf(object) { 15 var type = typeof object; 16 if (type === 'undefined') { 17 return 'undefined'; 18 } 19 if (object) { 20 type = object.constructor.name; 21 } else if (type === 'object') { 22 type = toString.call(object).slice(8, -1); 23 } 24 return type.toLowerCase(); 25 }