How to use the esprima-fb.Syntax.Property 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 Lapple / ErrorBoard / node_modules / react-tools / node_modules / jstransform / visitors / es6-class-visitors.js View on Github external
// Always munge non-computed properties of MemberExpressions
    // (a la preventing access of properties of unowned objects)
    if (path[0].type === Syntax.MemberExpression && path[0].object !== node
        && path[0].computed === false) {
      return true;
    }

    // Always munge identifiers that were declared within the method function
    // scope
    if (utils.identWithinLexicalScope(node.name, state, state.methodFuncNode)) {
      return true;
    }

    // Always munge private keys on object literals defined within a method's
    // scope.
    if (path[0].type === Syntax.Property
        && path[1].type === Syntax.ObjectExpression) {
      return true;
    }

    // Always munge function parameters
    if (path[0].type === Syntax.FunctionExpression
        || path[0].type === Syntax.FunctionDeclaration
        || path[0].type === Syntax.ArrowFunctionExpression) {
      for (var i = 0; i < path[0].params.length; i++) {
        if (path[0].params[i] === node) {
          return true;
        }
      }
    }
  }
  return false;
github andrewshawcare / thoughtworks-email-signature-generator / node_modules / jsxhint / node_modules / jstransform / visitors / es6-class-visitors.js View on Github external
// Always munge non-computed properties of MemberExpressions
    // (a la preventing access of properties of unowned objects)
    if (path[0].type === Syntax.MemberExpression && path[0].object !== node
        && path[0].computed === false) {
      return true;
    }

    // Always munge identifiers that were declared within the method function
    // scope
    if (utils.identWithinLexicalScope(node.name, state, state.methodFuncNode)) {
      return true;
    }

    // Always munge private keys on object literals defined within a method's
    // scope.
    if (path[0].type === Syntax.Property
        && path[1].type === Syntax.ObjectExpression) {
      return true;
    }

    // Always munge function parameters
    if (path[0].type === Syntax.FunctionExpression
        || path[0].type === Syntax.FunctionDeclaration
        || path[0].type === Syntax.ArrowFunctionExpression) {
      for (var i = 0; i < path[0].params.length; i++) {
        if (path[0].params[i] === node) {
          return true;
        }
      }
    }
  }
  return false;
github facebookarchive / jstransform / visitors / es6-object-computed-property-visitors.js View on Github external
true // previousWasSpread
      );
      utils.append((lastWasSpread ? '' : '}') + ')', state);
      ii = nextComputedPropertyIndex - 1;
      continue;

    // short notation / dot access
    } else if (
      property.type === Syntax.Property &&
      property.key.type === Syntax.Identifier &&
      !property.computed
    ) {
      utils.append(obj + '.' + property.key.name + '=', state);

    // literals / computed properties
    } else if (property.type === Syntax.Property) {
      utils.append(obj + '[', state);
      process(traverse, property.key, path, state);
      utils.append(']=', state);
    }

    // concise methods
    if (property.method === true) {
      utils.catchupWhiteSpace(property.key.range[1], state);
      es6ObjectConciseMethods.renderConciseMethod(traverse, property, path, state);
    }
    process(traverse, property.value, path, state);
  }
  utils.catchupWhiteSpace(node.range[1], state);
  utils.append(',' + obj + ')', state);
  return false;
}
github facebookarchive / jstransform / visitors / undefined-to-void-0-visitors.js View on Github external
);
          }
          break;
        case Syntax.MemberExpression:
          // skips: `foo.undefined` but not `foo[undefined]`
          if (node === path[0].property && !path[0].computed) {
            return false;
          }
          break;
        case Syntax.VariableDeclarator:
          // skips: `var undefined`
          if (node !== path[0].init) {
            return false;
          }
          break;
        case Syntax.Property:
          // skips: `undefined: foo`
          if (node === path[0].key) {
            return false;
          }
          break;
      }
    }
    return true;
  }
  return false;
};
github facebookarchive / jstransform / visitors / react-display-name-visitors.js View on Github external
visitReactDisplayName.test = function(object, path, state) {
  return (
    object.type === Syntax.AssignmentExpression ||
    object.type === Syntax.Property ||
    object.type === Syntax.VariableDeclarator
  );
};
github facebookarchive / jstransform / visitors / es6-object-concise-method-visitors.js View on Github external
visitObjectConciseMethod.test = function(node, path, state) {
  return node.type === Syntax.Property &&
    node.value.type === Syntax.FunctionExpression &&
    node.method === true;
};
github joshuaslate / saas-tutorial / node_modules / jstransform / visitors / es6-object-concise-method-visitors.js View on Github external
visitObjectConciseMethod.test = function(node, path, state) {
  return node.type === Syntax.Property &&
    node.value.type === Syntax.FunctionExpression &&
    node.method === true;
};
github facebookarchive / jstransform / visitors / es6-object-short-notation-visitors.js View on Github external
visitObjectLiteralShortNotation.test = function(node, path, state) {
  return node.type === Syntax.Property &&
    node.kind === 'init' &&
    node.shorthand === true &&
    path[0].type !== Syntax.ObjectPattern;
};
github facebookarchive / jstransform / visitors / reserved-words-visitors.js View on Github external
visitProperty.test = function(node) {
  return node.type === Syntax.Property &&
    node.key.type === Syntax.Identifier &&
    !node.method &&
    !node.shorthand &&
    !node.computed &&
    reserverdWordsHelper.isES3ReservedWord(node.key.name);
};
github andrewshawcare / thoughtworks-email-signature-generator / node_modules / jsxhint / node_modules / jstransform / visitors / es6-object-concise-method-visitors.js View on Github external
visitObjectConciseMethod.test = function(node, path, state) {
  return node.type === Syntax.Property &&
    node.value.type === Syntax.FunctionExpression &&
    node.method === true;
};