Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

get-function-arguments

tunnckocore1.7kMIT1.0.0

Get function arguments, useful for and used in dependency injectors. Works for regular functions, generator functions and arrow functions.

args, arguments, arrow, arrow-function, arrows, dependency, deps, fn, func, function, function-arguments, generator, generators, get, inject, injectors, parameters, params, regular, useful

readme

get-function-arguments npmjs.com The MIT License

Get function arguments, useful for and used in dependency injectors. Works for regular functions, generator functions and arrow functions.

code climate standard code style travis build status coverage status dependency status

Install

npm i get-function-arguments --save

Usage

For more use-cases see the tests

const getFunctionArguments = require('get-function-arguments')

getFunctionArguments

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

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' ]

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.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckoCore.tk keybase tunnckoCore tunnckoCore npm tunnckoCore twitter tunnckoCore github

changelog

1.0.0 - 2016-03-18

0.0.0 - 2016-03-18

  • Initial commit