-
-
Save jaubourg/305434 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
var toString = Object.prototype.toString; | |
var class2type = { | |
"[object Boolean]": "boolean", | |
"[object Number]": "number", | |
"[object String]": "string", | |
"[object Function]": "function", | |
"[object Array]": "array", | |
"[object Date]": "date", | |
"[object RegExp]": "regexp" | |
}; | |
$.typeOf = function( obj ) { | |
if ( !obj ) { | |
return obj === null ? "null" : typeof obj; | |
} | |
return class2type[ toString.call( obj ) ] || "object"; | |
}; | |
})(jQuery || window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment