How to use the isReturnStatement function from babel-types
Find comprehensive JavaScript babel-types.isReturnStatement code examples handpicked from public code repositorys.
70 71 72 73 74 75 76 77 78
const node = path.node; // only matches inside directives // return { .. controller: function($scope, $timeout), ...} return limit("directive", t.isReturnStatement(node) && node.argument && t.isObjectExpression(node.argument) && matchProp("controller", (path.get && path.get("argument.properties") || node.argument.properties))); }
156
0
2
+ 5 other calls in file
117 118 119 120 121 122 123 124 125 126
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 ') } } const retSta = node.body.body.filter(n => t.isReturnStatement(n)).shift() if (!retSta || retSta.argument === null || !t.isObjectExpression(retSta.argument)) { throw new Error('sfc-editor:data function did not return an object!') } const retObjProps = retSta.argument.properties
1
3
2
+ 11 other calls in file
GitHub: zhuiyixinian/anu
27 28 29 30 31 32 33 34 35 36
// const expr = body[0]; // console.log(body); switch (true) { case t.isReturnStatement(expr): var needWrap = expr.argument.type !== 'JSXElement'; var jsx = generate(expr.argument).code; var jsxAst = babel.transform(jsx, { babelrc: false,
330
0
0
GitHub: dwqs/vue-to-react
55 56 57 58 59 60 61 62 63
// Array this.state.props[this.childKey].value = body; } else if (t.isBlockStatement(body)) { // Object/Block array const childNodes = body.body; if (childNodes.length === 1 && t.isReturnStatement(childNodes[0])) { this.state.props[this.childKey].value = childNodes[0].argument; } }
65
411
8
babel-types.identifier is the most popular function in babel-types (4076 examples)