Created
December 18, 2017 15:26
-
-
Save SethVandebrooke/b7066491760809d64d5424dd41813af0 to your computer and use it in GitHub Desktop.
Get an array of the parameters defined for a given function
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
function definedParameters(func) { | |
return func.toString().split("\n")[0].match(/\({1}.*\){1}/)[0].replace("(","").replace(")","").split(" ").join("").split(","); | |
} | |
// definedParameters(function (a,b,c){return a*b*c;}) returns ["a","b","c"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment