README
get-function-args-x
Get the args of the function.
⇒ module.exports(fn)undefined
| Array
⏏
This method returns the args of the function, or undefined
if not
a function.
Kind: Exported function
Returns: undefined
| Array
- The args of the function, or undefined
if
not a function.
Param | Type | Description |
---|---|---|
fn | function |
The function to get the args of. |
Example
import getFunctionArgs from 'get-function-args-x';
getFunctionArgs(); // undefined
getFunctionArgs(Number.MIN_VALUE); // undefined
getFunctionArgs('abc'); // undefined
getFunctionArgs(true); // undefined
getFunctionArgs({name: 'abc'}); // undefined
getFunctionArgs(function() {}); // []
getFunctionArgs(new Function()); // []
getFunctionArgs(function test() {}); // []
getFunctionArgs(function test(a, b) {}); // ['a', 'b']
getFunctionArgs(function* test(a, b) {}); // ['a', 'b']
getFunctionArgs((a, b) => {}); // ['a', 'b']
getFunctionArgs(async function test(a, b) {}); // ['a', 'b']