Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xotic750/get-function-args-x

Get the args of the function.
https://github.com/xotic750/get-function-args-x

arguments browser ecmascript name nodejs

Last synced: 15 days ago
JSON representation

Get the args of the function.

Awesome Lists containing this project

README

        


Travis status


Dependency status


devDependency status


npm version


jsDelivr hits


bettercodehub score


Coverage Status

## 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**

```js
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']
```