How to use @babel/helper-get-function-arity - 1 common examples

To help you get started, we’ve selected a few @babel/helper-get-function-arity examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github babel / babel / packages / babel-helper-function-name / src / index.js View on Github external
// need to add a wrapper since we can't change the references
      let build = buildPropertyMethodAssignmentWrapper;
      if (method.generator) {
        build = buildGeneratorPropertyMethodAssignmentWrapper;
      const template = build({
        FUNCTION: method,
        FUNCTION_ID: id,
        FUNCTION_KEY: scope.generateUidIdentifier(,

      // shim in dummy params to retain function arity, if you try to read the
      // source then you'll get the original since it's proxied so it's all good
      const params = template.callee.body.body[0].params;
      for (let i = 0, len = getFunctionArity(method); i < len; i++) {

      return template;
  } = id;
  scope.getProgramParent().references[] = true;


Helper function to get function arity

Latest version published 2 years ago

Package Health Score

88 / 100
Full package analysis

Popular @babel/helper-get-function-arity functions

Similar packages