silphius/app/astride/test/expression.js

9 lines
201 B
JavaScript
Raw Normal View History

2024-06-18 21:46:51 -05:00
export default async function(code) {
2024-06-22 10:47:17 -05:00
const {parse} = await import('acorn');
const ast = parse(code, {
ecmaVersion: 'latest',
sourceType: 'module',
});
2024-06-16 08:01:01 -05:00
return ast.body[0].expression;
}