Created
December 25, 2014 10:34
-
-
Save charlesponti/69798093b31606ad1c2c to your computer and use it in GitHub Desktop.
Get JavaScript function argument names
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
var x = function(x, y) { | |
/** code */ | |
}; | |
x.toString() | |
.replace(/((\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s))/mg,'') | |
.match(/^function\s*[^\(]*\(\s*([^\)]*)\)/m)[1] | |
.split(/,/) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment