Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104935979
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
Thu, Mar 13, 12:15
Size
401 B
Mime Type
text/x-java
Expires
Sat, Mar 15, 12:15 (2 d)
Engine
blob
Format
Raw Data
Handle
24883718
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