Skip to content

Instantly share code, notes, and snippets.

@koderhun
Forked from ufocoder/type.js
Created February 25, 2020 04:10
Show Gist options
  • Save koderhun/619a07a47c85ae75b13bc9be030dc898 to your computer and use it in GitHub Desktop.
Save koderhun/619a07a47c85ae75b13bc9be030dc898 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