Skip to content

Instantly share code, notes, and snippets.

@ufocoder
Created October 21, 2018 11:58
Show Gist options
  • Save ufocoder/7df39101a36b1784b853513e15d134c6 to your computer and use it in GitHub Desktop.
Save ufocoder/7df39101a36b1784b853513e15d134c6 to your computer and use it in GitHub Desktop.
function type(value) {
var regex = /^\[object (\S+?)\]$/;
var matches = Object.prototype.toString.call(value).match(regex) || [];
return (matches[1] || 'undefined').toLowerCase();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment