Skip to content

Instantly share code, notes, and snippets.

@ionurboz
Created March 18, 2019 13:21
Show Gist options
  • Save ionurboz/9a6bbbf3d9416253a4f09bc94028ad26 to your computer and use it in GitHub Desktop.
Save ionurboz/9a6bbbf3d9416253a4f09bc94028ad26 to your computer and use it in GitHub Desktop.
More accurately check the type of a JavaScript object
/**
* More accurately check the type of a JavaScript object
* @param {Object} obj The object
* @return {String} The object type
*/
var trueTypeOf = function (obj) {
return Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment