Skip to content

Instantly share code, notes, and snippets.

@themgoncalves
Created August 17, 2020 15:41
Show Gist options
  • Save themgoncalves/d2d643c293e225ad41fbb9c50dcbd34b to your computer and use it in GitHub Desktop.
Save themgoncalves/d2d643c293e225ad41fbb9c50dcbd34b to your computer and use it in GitHub Desktop.
Making JavaScript typeof() work - Es6
const typeOf = (value) =>
({}.toString
.call(value)
.match(/\s([a-zA-Z]+)/)[1]
.toLowerCase());
export default typeOf;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment