How to use the isObjectExpression function from babel-types

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

168
169
170
171
172
173
174
175
176
177
}

// /** @lends Foo */{ bar: ... }
if (n.isIdentifier(path.node) &&
    n.isObjectProperty(path.parentPath) &&
    n.isObjectExpression(path.parentPath.parentPath)) {
  // The @lends comment is sometimes attached to the first property rather than
  // the object expression itself.
  identifiers = findLendsIdentifiers(path.parentPath.parentPath.node) ||
      findLendsIdentifiers(path.parentPath.parentPath.node.properties[0]);
fork icon510
star icon0
watch icon2

+ 11 other calls in file

54
55
56
57
58
59
60
61
62
63
const method = callee.property; // identifier
const args = node.arguments;

if (t.isIdentifier(obj) &&
    ((is.someof(obj.name, ["$modal", "$uibModal"]) && method.name === "open") || (is.someof(obj.name, ["$mdDialog", "$mdToast", "$mdBottomSheet"]) && method.name === "show")) &&
    args.length === 1 && t.isObjectExpression(args[0])) {
    let args = path.get("arguments");
    const props = args[0].get("properties");
    const res = [matchProp("controller", props)];
    res.push.apply(res, matchResolve(props));
fork icon156
star icon0
watch icon2

+ 11 other calls in file

131
132
133
134
135
136
137
138
139
140
// if (key.name !== 'pages' || !t.isArrayExpression(value)) return
if (key.name === 'pages' && t.isArrayExpression(value)) {
  value.elements.forEach(v => {
    pages.push(v.value)
  })
} else if (key.name === 'tabBar' && t.isObjectExpression(value)) {
  // tabBar
  tabBar = value
  value.properties.forEach(node => {
    if (node.key.name === 'position') tabbarPos = node.value.value
fork icon0
star icon2
watch icon2

+ 13 other calls in file

421
422
423
424
425
426
427
428
429
430
            pages.push([pageName, renamePagename(pageName).replace(/\//g, '')]);
            v.value = helper_1.addLeadingSlash(v.value);
        });
    }
}
else if (keyName === 'tabBar' && t.isObjectExpression(value)) {
    // tabBar相关处理
    tabBar = value;
    value.properties.forEach((node) => {
        if (t.isSpreadProperty(node))
fork icon0
star icon0
watch icon0

+ 11 other calls in file

88
89
90
91
92
93
94
95
96
97
}
// window
if (key.name === 'window' && t.isObjectExpression(value)) {
    return;
}
if (key.name === 'tabBar' && t.isObjectExpression(value)) {
    astPath.traverse({
        ObjectProperty(astPath) {
            const node = astPath.node;
            const value = node.value.value;
fork icon0
star icon0
watch icon0

+ 20 other calls in file

352
353
354
355
356
357
358
359
360
361
  }
  value.elements.forEach(v => {
    const pagePath = `${root}/${v.value}`.replace(/\/{2,}/g, '/')
    pages.push(pagePath.replace(/^\//, ''))
  })
} else if (keyName === 'tabBar' && t.isObjectExpression(value)) {
  // tabBar
  tabBar = value
  value.properties.forEach(node => {
    if (node.keyName === 'position') tabbarPos = node.value.value
fork icon0
star icon0
watch icon0

+ 3 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)