Adam 3214c5004e docs - Add helper-get-function-arity readme [skip ci] (#6532)
* Add README to babel-helper-get-function-arity

* Use javascript template

* Address code review

* Comment out ellipsis
2017-10-23 10:30:36 +02:00

543 B

@babel/helper-get-function-arity

Function that returns the number of arguments that a function takes.

  • Examples of what is considered an argument can be found at MDN Web Docs

Usage

import getFunctionArity from "@babel/helper-get-function-arity";

function wrap(state, method, id, scope) {
  // ...
  if (!t.isFunction(method)) {
    return false;
  }

  const argumentsLength = getFunctionArity(method);

  // ...
}