Package Exports
- function-arguments
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (function-arguments) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
function-arguments

Get arguments of a function, useful for and used in dependency injectors. Works for regular functions, generator functions and arrow functions.
Install
npm i function-arguments --saveUsage
For more use-cases see the tests
const functionArguments = require('function-arguments')functionArguments
Get function arguments names.
Params
fn{Function}: Function from which to get arguments names.max{Number}: How many characters to cut fromfns toString.returns{Array}
Example
var fnArgs = require('function-arguments')
console.log(fnArgs(function (a, b, c) {})) // => [ 'a', 'b', 'c' ]
console.log(fnArgs(function named (a , b, c) {})) // => [ 'a', 'b', 'c' ]
console.log(fnArgs(a => {})) // => [ 'a' ]
console.log(fnArgs((a, b) => {})) // => [ 'a', 'b' ]
console.log(fnArgs(function * (a ,b, c) {})) // => [ 'a', 'b', 'c' ]
console.log(fnArgs(function * named (a ,b, c) {})) // => [ 'a', 'b', 'c' ]Works when using comments
As it works for ES2015, it also works if you use comments in weird places.
console.log(fnArgs(function /* something may */ (
// go,
go,
/* wrong, */
here
// (when, using, comments) {}
) { return 1 })) // => [ 'go', 'here' ]Related
- flatten-arguments: Fastest, simplest and smallest. Pass
argumentsobject or list… more | homepage - fn-args: Get the arguments of a function | homepage
- fn-name: Get the name of a named function | homepage
- get-fn-name: Get function name with strictness and correctness in mind.… more | homepage
- handle-arguments: Handles given Arguments object - return separatly last argument… more | homepage
- manage-arguments: Prevents arguments leakage - managing arguments. From Optimization killers… more | homepage
- parse-function: Parse a function, arrow function or string to object… more | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.