How to use the objectMethod function from @babel/types
Find comprehensive JavaScript @babel/types.objectMethod code examples handpicked from public code repositorys.
55 56 57 58 59 60 61 62 63 64
/** * 转换ClassMethod为ObjectMethod */ function transformClassMethodToObjectMethod(pathNode) { let node = t.objectMethod("method", pathNode.key, pathNode.params, pathNode.body, pathNode.computed); node.async = pathNode.async; return node; } /**
+ 17 other calls in file
GitHub: groupon/swagql
![groupon profile picture](/groupon.png?size=40)
63 64 65 66 67 68 69 70 71 72
t.variableDeclarator( t.identifier(graphqlName), t.newExpression(typeMap.scalarTypeRef, [ t.objectExpression([ t.objectProperty(t.identifier('name'), t.stringLiteral(graphqlName)), t.objectMethod( 'method', t.identifier('serialize'), [t.identifier('value')], t.blockStatement([t.returnStatement(t.identifier('value'))])
130 131 132 133 134 135 136 137 138 139
} } let pageWxsInfo = global.pageWxsInfo[key]; if (pageWxsInfo) { if (!node) { node = t.objectMethod("method", t.identifier(funName), [], t.blockStatement([])); liftCycleArr.unshift(node); } pageWxsInfo.forEach(obj => { let left = t.memberExpression(t.thisExpression(), t.identifier(obj.module));
@babel/types.identifier is the most popular function in @babel/types (20936 examples)