How to use the isMemberExpression function from babel-types

Find comprehensive JavaScript babel-types.isMemberExpression code examples handpicked from public code repositorys.

33
34
35
36
37
38
39
40
41
42
);
out_file.write('/*\n *\n * https://www.w3.org/Style/CSS/all-properties.en.html\n */\n\n');

function isModuleDotExports(node) {
  return (
    t.isMemberExpression(node, { computed: false }) &&
    t.isIdentifier(node.object, { name: 'module' }) &&
    t.isIdentifier(node.property, { name: 'exports' })
  );
}
fork icon59
star icon89
watch icon10

+ 77 other calls in file

110
111
112
113
114
115
116
117
118
119

Compiler.prototype.ast_postprocess = function(ast) {
    let needCompaction = function(c) {
      return t.isExpressionStatement(c)
                && t.isCallExpression(c.expression)
                && t.isMemberExpression(c.expression.callee)
                && t.isIdentifier(c.expression.callee.object)
                && c.expression.callee.object.name === 'buf'
                && t.isIdentifier(c.expression.callee.property)
                && c.expression.callee.property.name === 'push'
fork icon5
star icon43
watch icon0

+ 7 other calls in file

39
40
41
42
43
44
45
46
47

const parts = Array.isArray(match) ? match : match.split('.');
const nodes = [];

let node;
for (node = member; babelTypes.isMemberExpression(node); node = node.object) {
  nodes.push(node.property);
}
nodes.push(node);
fork icon0
star icon49
watch icon1

+ 5 other calls in file

143
144
145
146
147
148
149
150
151
152
 * Deal with an oddity of espree: the jsdoc comment is attached to a different
 * node in the two expressions `a.b = c` vs `a.b = function () {}`.
 */
if (n.isExpressionStatement(path.node) &&
    n.isAssignmentExpression(path.node.expression) &&
    n.isMemberExpression(path.node.expression.left)) {
  path = path.get('expression').get('left');
}

/*
fork icon510
star icon0
watch icon2

+ 3 other calls in file

17
18
19
20
21
22
23
24
25
26

function match(path, ctx, explicitOnly) {
    const node = path.node;
    const isMethodCall = (
        t.isCallExpression(node) &&
            t.isMemberExpression(node.callee) &&
            node.callee.computed === false
        );

    if(isMethodCall && ngInject.inspectComment(path, ctx)){
fork icon156
star icon0
watch icon2

+ 11 other calls in file

39
40
41
42
43
44
45
46
47
48
(attr, idx) => {
  if (t.isJSXSpreadAttribute(attr)) {
    invariant(
      // only allow member expressions and identifiers to be spread for now
      t.isIdentifier(attr.argument) ||
        t.isMemberExpression(attr.argument),
      'Unhandled spread operator value of type `%s` (`%s`)',
      attr.argument.type,
      generate(attr).code
    );
fork icon62
star icon0
watch icon2

+ 5 other calls in file

25
26
27
28
29
30
31
32
33
34
out_file.write('\'use strict\';\n\n// autogenerated\n\n');
out_file.write('/*\n *\n * http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSS2Properties\n */\n\n');

function isModuleDotExports(node) {
  return (
    t.isMemberExpression(node, {computed: false}) &&
    t.isIdentifier(node.object, {name: 'module'}) &&
    t.isIdentifier(node.property, {name: 'exports'})
  );
}
fork icon20
star icon50
watch icon8

+ 5 other calls in file

214
215
216
217
218
219
}

// If we can statically evaluate the name of a CommonJS export, create an ES6-style export for it.
// This allows us to remove the CommonJS export object completely in many cases.
if (
  t.isMemberExpression(left) &&
fork icon0
star icon1
watch icon3

+ 9 other calls in file

36
37
38
39
40
41
42
43
44
45
CallExpression: {
  enter (path) {
    const callee = path.node.callee
    const args = path.node.arguments
    if (
      t.isMemberExpression(callee) &&
      t.isThisExpression(callee.object) &&
      (callee.property.name === '__travel' || callee.property.value === '__travel') &&
      t.isBooleanLiteral(args[2]) &&
      args[2].value === true
fork icon349
star icon0
watch icon0

+ 5 other calls in file

139
140
141
142
143
144
145
146
147
148
            });
        }
    }
}

if (t.isCallExpression(p.node) && t.isMemberExpression(p.node.callee) && p.node.callee.object.name == 'ReactDOM' && p.node.callee.property.name == 'render' && t.isJSXElement(p.node.arguments[0])) {

    var el = p.node.arguments[0].openingElement;

    objArr.forEach(function (obj) {
fork icon1
star icon11
watch icon1

+ 7 other calls in file

163
164
165
166
167
168
169
170
171
    }

}

if (t.isCallExpression(p.node) && 
    t.isMemberExpression(p.node.callee) &&
    p.node.callee.object.name == 'ReactDOM' &&
    p.node.callee.property.name == 'render' &&
    t.isJSXElement(p.node.arguments[0])) {
fork icon1
star icon11
watch icon1

+ 3 other calls in file

270
271
272
273
274
275
276
277
278
279
}

const expr = t.list([t.symbol("set!"), next(ast.left), next(ast.right)]);

if (
  bt.isMemberExpression(ast.left) &&
  utils.isNestedThisExpression(ast.left)
) {
  utils.alterNestedThisExpression("that", ast.left);
  return THIS_AS("that", [expr]);
fork icon5
star icon91
watch icon0

185
186
187
188
189
190
191
192
193
194
// Change displayName
let displayNameExpression = ast.program.body.find(
  stmt =>
    types.isExpressionStatement(stmt) &&
    types.isAssignmentExpression(stmt.expression) &&
    types.isMemberExpression(stmt.expression.left) &&
    stmt.expression.left.object.name === 'newComponent'
).expression;

displayNameExpression.left.object.name = this._componentName;
fork icon0
star icon2
watch icon0

+ 3 other calls in file

66
67
68
69
70
71
72
73
74
75
76
t.isRegExpLiteral(n);


function simplifyCharCodeAt(path) {
  var node = path.node;
  var charCodeCallExprNode = (t.isCallExpression(node.left)
  && t.isMemberExpression(node.left.callee)
  && t.isIdentifier(node.left.callee.property)
  && node.left.callee.property.name === 'charCodeAt') ?
    node.left :
    (t.isCallExpression(node.right)
fork icon0
star icon1
watch icon2

+ 5 other calls in file

238
239
240
241
242
243
244
245
246
247
VariableDeclarator: path => {
  variables = [...variables, path.node.id.name];
},

AssignmentExpression: path => {
  if (path.node.operator === "=" && t.isMemberExpression(path.node.left)) {
    if (t.isThisExpression(path.node.left.object)) {
      members = [...members, path.node.left.property.name];
    }
  }
fork icon2
star icon0
watch icon0

95
96
97
98
99
100
101
102
103
104
// redeclared in this scope
if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;

if (path.parentPath.isCallExpression({callee: path.node})) {
  path.replaceWith(t.sequenceExpression([t.numericLiteral(0), remap]));
} else if (path.isJSXIdentifier() && t.isMemberExpression(remap)) {
  const {object, property} = remap;
  path.replaceWith(
    t.JSXMemberExpression(
      t.JSXIdentifier(object.name),
fork icon0
star icon0
watch icon3

+ 19 other calls in file

73
74
75
76
77
78
79
80
81
82

const parts = Array.isArray(match) ? match : match.split('.');
const nodes = [];

let node;
for (node = member; types.isMemberExpression(node); node = node.object) {
  nodes.push(node.property);
}

nodes.push(node);
fork icon0
star icon0
watch icon2

+ 11 other calls in file

Other functions in babel-types

Sorted by popularity

function icon

babel-types.identifier is the most popular function in babel-types (4076 examples)