Get function arguments, useful for and used in dependency injectors. Works for regular functions, generator functions and arrow functions.
npm install get-function-arguments> Get function arguments, useful for and used in dependency injectors. Works for regular functions, generator functions and arrow functions.
[![code climate][codeclimate-img]][codeclimate-url] [![standard code style][standard-img]][standard-url] [![travis build status][travis-img]][travis-url] [![coverage status][coveralls-img]][coveralls-url] [![dependency status][david-img]][david-url]
npm i get-function-arguments --save
`Usage
> For more use-cases see the tests`js
const getFunctionArguments = require('get-function-arguments')
`$3
> Get function arguments names.Params
*
fn {Function}: Function from which to get arguments names.
* max {Number}: How many characters to cut from fns toString.
* returns {Array} Example
`js
var fnArgs = require('get-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' ]
`Related
* flatten-arguments: Fastest, simplest and smallest. Pass arguments` object or list of… more | homepage[![tunnckoCore.tk][author-www-img]][author-www-url] [![keybase tunnckoCore][keybase-img]][keybase-url] [![tunnckoCore npm][author-npm-img]][author-npm-url] [![tunnckoCore twitter][author-twitter-img]][author-twitter-url] [![tunnckoCore github][author-github-img]][author-github-url]
[function-arguments]: https://github.com/tunnckocore/function-arguments
[npmjs-url]: https://www.npmjs.com/package/get-function-arguments
[npmjs-img]: https://img.shields.io/npm/v/get-function-arguments.svg?label=get-function-arguments
[license-url]: https://github.com/tunnckoCore/function-arguments/blob/master/LICENSE
[license-img]: https://img.shields.io/badge/license-MIT-blue.svg
[codeclimate-url]: https://codeclimate.com/github/tunnckoCore/function-arguments
[codeclimate-img]: https://img.shields.io/codeclimate/github/tunnckoCore/function-arguments.svg
[travis-url]: https://travis-ci.org/tunnckoCore/function-arguments
[travis-img]: https://img.shields.io/travis/tunnckoCore/function-arguments/master.svg
[coveralls-url]: https://coveralls.io/r/tunnckoCore/function-arguments
[coveralls-img]: https://img.shields.io/coveralls/tunnckoCore/function-arguments.svg
[david-url]: https://david-dm.org/tunnckoCore/function-arguments
[david-img]: https://img.shields.io/david/tunnckoCore/function-arguments.svg
[standard-url]: https://github.com/feross/standard
[standard-img]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[author-www-url]: http://www.tunnckocore.tk
[author-www-img]: https://img.shields.io/badge/www-tunnckocore.tk-fe7d37.svg
[keybase-url]: https://keybase.io/tunnckocore
[keybase-img]: https://img.shields.io/badge/keybase-tunnckocore-8a7967.svg
[author-npm-url]: https://www.npmjs.com/~tunnckocore
[author-npm-img]: https://img.shields.io/badge/npm-~tunnckocore-cb3837.svg
[author-twitter-url]: https://twitter.com/tunnckoCore
[author-twitter-img]: https://img.shields.io/badge/twitter-@tunnckoCore-55acee.svg
[author-github-url]: https://github.com/tunnckoCore
[author-github-img]: https://img.shields.io/badge/github-@tunnckoCore-4183c4.svg
[freenode-url]: http://webchat.freenode.net/?channels=charlike
[freenode-img]: https://img.shields.io/badge/freenode-%23charlike-5654a4.svg
[new-message-url]: https://github.com/tunnckoCore/ama
[new-message-img]: https://img.shields.io/badge/ask%20me-anything-green.svg