Last active
March 14, 2020 11:44
-
-
Save aashutoshrathi/36983081994b469053132f3e8fdd7460 to your computer and use it in GitHub Desktop.
Get Actual Type In JS
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 getActualType = weirdo => | |
toString | |
.call(weirdo) | |
.match(/([A-Z])\w+/)[0] | |
.toLowerCase(); | |
// toString.call(T) returns "[Object <TypeOfT>]", I find the first word with Capital Letter as front. |
Author
aashutoshrathi
commented
Mar 14, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment