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: about 2 months ago
JSON representation
Get the args of the function.
- Host: GitHub
- URL: https://github.com/xotic750/get-function-args-x
- Owner: Xotic750
- License: mit
- Created: 2016-01-05T23:05:36.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T23:18:20.000Z (over 3 years ago)
- Last Synced: 2025-03-05T09:48:02.877Z (over 1 year ago)
- Topics: arguments, browser, ecmascript, name, nodejs
- Language: JavaScript
- Homepage:
- Size: 3.53 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## get-function-args-x
### `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']
```