function-params
v0.1.0
Published
Get parameter names for a given function (with ES6 arrow syntax support)
Downloads
260
Maintainers
Readme
function-params
Get parameter names for a given function (with ES6 arrow syntax support)
Installation
Install function-params
using npm:
npm install --save function-params
Usage
Module usage
var functionParams = require('function-params');
functionParams(function (a, b, /* c */ d, e = 'f')); // ['a', 'b', 'd', 'e']
// Arrow functions:
functionParams(a => a); // ['a']
API
functionParams(fn)
| Name | Type | Description |
|------|------|-------------|
| fn | Function
| The function to get parameter names for |
Get parameter names from a function.
functionParams.fromString(str)
| Name | Type | Description |
|------|------|-------------|
| str | String
| A stringified function to get parameter names for |
Get parameter names from a function string.
License
MIT