Is there a way to get the function parameter names of a function dynamically?
Let’s say my function looks like this:
function doSomething(param1, par
Whatever the solution, it must not break on wierd functions, whose toString() looks just as wierd:
function ( A, b
,c ,d
){}

Also, why use complex regular expressions? This can be done like:
function getArguments(f) {
return f.toString().split(')',1)[0].replace(/\s/g,'').substr(9).split(',');
}
This works everywhere with every function, and the only regex is whitespace removal that doesn't even process the whole string due to the .split trick.