Skip to content

Instantly share code, notes, and snippets.

@aashutoshrathi
Last active March 14, 2020 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aashutoshrathi/36983081994b469053132f3e8fdd7460 to your computer and use it in GitHub Desktop.
Save aashutoshrathi/36983081994b469053132f3e8fdd7460 to your computer and use it in GitHub Desktop.
Get Actual Type In JS
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.
@aashutoshrathi
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment