forked from NodeSecure/js-x-ray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
39 lines (32 loc) · 760 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Import Internal Dependencies
import { warnings } from "./src/warnings.js";
import { JsSourceParser } from "./src/JsSourceParser.js";
import { AstAnalyser } from "./src/AstAnalyser.js";
function runASTAnalysis(
str,
options = Object.create(null)
) {
const {
customParser = new JsSourceParser(),
...opts
} = options;
const analyser = new AstAnalyser(customParser);
return analyser.analyse(str, opts);
}
async function runASTAnalysisOnFile(
pathToFile,
options = {}
) {
const {
customParser = new JsSourceParser(),
...opts
} = options;
const analyser = new AstAnalyser(customParser);
return analyser.analyseFile(pathToFile, opts);
}
export {
warnings,
AstAnalyser,
runASTAnalysis,
runASTAnalysisOnFile
};