MCPcopy
hub / github.com/Mottie/Keyboard / objectType

Function objectType

testing/qunit-2.9.2.js:238–270  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

236 }
237
238 function objectType(obj) {
239 if (typeof obj === "undefined") {
240 return "undefined";
241 }
242
243 // Consider: typeof null === object
244 if (obj === null) {
245 return "null";
246 }
247
248 var match = toString.call(obj).match(/^\[object\s(.*)\]$/),
249 type = match && match[1];
250
251 switch (type) {
252 case "Number":
253 if (isNaN(obj)) {
254 return "nan";
255 }
256 return "number";
257 case "String":
258 case "Boolean":
259 case "Array":
260 case "Set":
261 case "Map":
262 case "Date":
263 case "RegExp":
264 case "Function":
265 case "Symbol":
266 return type.toLowerCase();
267 default:
268 return typeof obj === "undefined" ? "undefined" : _typeof(obj);
269 }
270 }
271
272 // Safe object type checking
273 function is(type, obj) {

Callers 9

isFunction · 0.85
isContainerFunction · 0.85
typeEquivFunction · 0.85
processModuleFunction · 0.85
emitFunction · 0.85
onFunction · 0.85
loggingCallbackFunction · 0.85
registerLoggingCallbacksFunction · 0.85
qunit-2.9.2.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected