Created
June 27, 2017 22:32
-
-
Save jamesholcomb/0029ef3f5b37f67930818abe42790fdd to your computer and use it in GitHub Desktop.
Get function name from inside scope
This file contains 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 myCoolFunc = () => { | |
const name = new Error().stack.match(/at (.*?) /)[1] | |
console.log(name) // myCoolFunc | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment