19 lines
411 B
JavaScript
19 lines
411 B
JavaScript
import syntaxDoExpressions from "babel-plugin-syntax-do-expressions";
|
|
|
|
export default function () {
|
|
return {
|
|
inherits: syntaxDoExpressions,
|
|
|
|
visitor: {
|
|
DoExpression(path) {
|
|
const body = path.node.body.body;
|
|
if (body.length) {
|
|
path.replaceWithMultiple(body);
|
|
} else {
|
|
path.replaceWith(path.scope.buildUndefinedNode());
|
|
}
|
|
},
|
|
},
|
|
};
|
|
}
|