doc: Merged old docs for Function#argumentNames.

This commit is contained in:
tjcrowder 2009-09-10 10:31:56 +01:00
parent cf72372092
commit 29b81fda69
1 changed files with 11 additions and 0 deletions

View File

@ -23,6 +23,17 @@ Object.extend(Function.prototype, (function() {
* Reads the argument names as stated in the function definition and returns
* the values as an array of strings (or an empty array if the function is
* defined without parameters).
*
* ### Examples
*
* function fn(foo, bar) {
* return foo + bar;
* }
* fn.argumentNames();
* //-> ['foo', 'bar']
*
* Prototype.emptyFunction.argumentNames();
* //-> []
**/
function argumentNames() {
var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1]