How to use the isObjectMethod function from babel-types

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

5
6
7
8
9
10
11
12
13
14
function parseNode(contextNode) {
  if (
    t.isFunctionExpression(contextNode) ||
    t.isArrowFunctionExpression(contextNode) ||
    t.isFunctionDeclaration(contextNode) ||
    t.isObjectMethod(contextNode)
  ) {
    return parseFunctionExpression(contextNode);
  }
  else if (t.isVariableDeclarator(contextNode)) {
fork icon3
star icon6
watch icon1

+ 7 other calls in file

110
111
112
113
114
115
116
117
118
119
plugins: [{
  visitor: {
    ExportDefaultDeclaration(path) {
      if(t.isObjectExpression(path.node.declaration)) {
        const props = path.node.declaration.properties
        var node = props.filter(p => t.isObjectMethod(p) && p.key.name === 'data').shift()
        if (!node) {
          node = props.filter(p => t.isObjectProperty(p) && p.key.name === 'data').shift()
          if (node) {
            throw new Error('sfd-editor:data should be a function, got an object ')
fork icon1
star icon3
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)