MCPcopy Create free account
hub / github.com/SAP/ui5-builder / parseJS

Function parseJS

lib/lbt/utils/parseUtils.js:14–32  ·  view source on GitHub ↗
(code, userOptions = {})

Source from the content-addressed store, hash-verified

12export const ecmaVersion = 2023;
13
14export function parseJS(code, userOptions = {}) {
15 // allowed options and their defaults
16 const options = {
17 comment: false,
18 ecmaVersion,
19 range: false,
20 sourceType: "script",
21 };
22
23 // validate and assign options
24 for (const [name, value] of Object.entries(userOptions)) {
25 if (!hasOwn(options, name)) {
26 throw new TypeError(`Allowed parser options are ${Object.keys(options)}, but not '${name}'`);
27 }
28 options[name] = value;
29 }
30
31 return parse(code, options);
32}
33
34export {Syntax, VisitorKeys} from "espree";

Callers 10

determineDependencyInfoFunction · 0.90
analyzeFunction · 0.90
rewriteDefineFunction · 0.90
ASTUtils.jsFile · 0.90
parseUtils.jsFile · 0.90
analyzeStringFunction · 0.90
parseFunction · 0.90

Calls 1

parseFunction · 0.85

Tested by

no test coverage detected