Created
August 17, 2020 15:41
-
-
Save themgoncalves/d2d643c293e225ad41fbb9c50dcbd34b to your computer and use it in GitHub Desktop.
Making JavaScript typeof() work - Es6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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