JSPM

get-function-arguments

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1554
  • Score
    100M100P100Q124165F
  • License MIT

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

Package Exports

  • get-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 (get-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

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