Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120647862
getAst.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jul 5, 22:51
Size
401 B
Mime Type
text/x-java
Expires
Mon, Jul 7, 22:51 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27221428
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
getAst.js
View Options
import "core-js/modules/es.object.assign";
import { Parser } from 'acorn';
export var ACORN_OPTIONS = {
ecmaVersion: 2019,
sourceType: 'module'
};
/**
* Parse source code with Acorn and return AST, returns undefined in case of errors
*/
export default function getAst(code) {
try {
return Parser.parse(code, Object.assign({}, ACORN_OPTIONS));
} catch (err) {
return undefined;
}
}
Event Timeline
Log In to Comment