How to use the esprima-fb.Syntax.MethodDefinition function in esprima-fb

To help you get started, we’ve selected a few esprima-fb 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 facebookarchive / jstransform / visitors / es7-trailing-comma-visitors.js View on Github external
function visitFunctionDefinitionArguments(traverse, node, path, state) {
  var end = node.range[1];
  if (node.type === Syntax.MethodDefinition) {
    node = node.value;
  }
  for (var index = 0; index < node.params.length; ++index) {
    utils.catchup(node.params[index].range[0], state);
    traverse(node.params[index], [node].concat(path), state);
    utils.catchup(node.params[index].range[1], state);
  }

  // delete first comma between the last argument and the closing parenthesis
  utils.catchup(node.body.range[0], state, function(value) {
    var commaIndex = value.substr(0, value.indexOf(")")).indexOf(",");
    return commaIndex > -1 ? value.replace(/,/, '') : value;
  });
  traverse(node.body, [node].concat(path), state);
  utils.catchup(end, state);
  return false;
github Caltech-IPAC / firefly / node_modules / react / node_modules / envify / node_modules / jstransform / visitors / es6-destructuring-visitors.js View on Github external
function isFunctionNode(node) {
  return (node.type == Syntax.FunctionDeclaration ||
    node.type == Syntax.FunctionExpression ||
    node.type == Syntax.MethodDefinition ||
    node.type == Syntax.ArrowFunctionExpression);
}
github guptag / FinCharts / app / node_modules / react / node_modules / envify / node_modules / jstransform / visitors / es6-class-visitors.js View on Github external
visitClassFunctionExpression.test = function(node, path, state) {
  return node.type === Syntax.FunctionExpression
         && path[0].type === Syntax.MethodDefinition;
};
github facebookarchive / jstransform / visitors / es6-destructuring-visitors.js View on Github external
function isFunctionNode(node) {
  return (node.type == Syntax.FunctionDeclaration ||
    node.type == Syntax.FunctionExpression ||
    node.type == Syntax.MethodDefinition ||
    node.type == Syntax.ArrowFunctionExpression);
}
github andrewshawcare / thoughtworks-email-signature-generator / node_modules / jsxhint / node_modules / jstransform / visitors / es6-class-visitors.js View on Github external
visitClassFunctionExpression.test = function(node, path, state) {
  return node.type === Syntax.FunctionExpression
         && path[0].type === Syntax.MethodDefinition;
};
github Lapple / ErrorBoard / node_modules / react-tools / node_modules / jstransform / visitors / es6-class-visitors.js View on Github external
visitClassMethod.test = function(node, path, state) {
  return node.type === Syntax.MethodDefinition;
};
github facebookarchive / jstransform / visitors / es6-class-visitors.js View on Github external
visitClassMethodParam.test = function(node, path, state) {
  if (!path[0] || !path[1]) {
    return;
  }

  var parentFuncExpr = path[0];
  var parentClassMethod = path[1];

  return parentFuncExpr.type === Syntax.FunctionExpression
         && parentClassMethod.type === Syntax.MethodDefinition
         && node.type === Syntax.Identifier;
};
github facebook / emitter / vendor / fbtransform / transforms / classes.js View on Github external
function findConstructorIndex(object) {
  var classElements = object.body && object.body.body || [];
  for (var i = 0; i < classElements.length; i++) {
    if (classElements[i].type === Syntax.MethodDefinition &&
      classElements[i].key.name === 'constructor') {
      return i;
    }
  }
  return -1;
}
github joshuaslate / saas-tutorial / node_modules / jstransform / visitors / es6-class-visitors.js View on Github external
visitClassMethod.test = function(node, path, state) {
  return node.type === Syntax.MethodDefinition;
};