itypeof
General data types for values with the option to get class names as well in strict mode
Interface
itypeof(value, strict)
Arguments
value (*): The value to get the typeof.
strict (Boolean): strict mode that will enable getting class names.
Returns
(string): returns type of value that was passed in (lowercased), When
a class name is returned it is not lowercased (so be careful).
How to use
var itypeof = ; console // -> stringconsole // -> booleanconsole // -> objectconsole // -> regexpconsole // -> arrayconsole // -> dateconsole // -> functionconsole // -> numberconsole // -> nullconsole // -> undefined { thisfoo = "foo" }console; // -> object //passing a strict parameter//will give you the class name of the objectconsole; // -> Foo
Please Note:
The regular typeof function will give you object
if it tests a regexp.
eg.
// regular typeofconsole // -> objectconsole // -> object
This is the main difference.
enjoy!
Credits
Ferron Hanse - Blog