function-params

0.1.0 • Public • Published

function-params

Build status NPM version

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

Package Sidebar

Install

npm i function-params

Weekly Downloads

60

Version

0.1.0

License

MIT

Last publish

Collaborators

  • joakimbeng