Skip to content

Commit

Permalink
accept review
Browse files Browse the repository at this point in the history
  • Loading branch information
zxkmm committed Dec 17, 2023
1 parent 8af6bdc commit 36f6589
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,8 @@ const inTryDeps = [...dependencies.getDependenciesInTryStatement()];

console.log(dependenciesName);
console.log(inTryDeps);
console.log(warnings);
console.dir(warnings, { depth: null });
```
---

If you meant to run this example with Node.js quickly in terminal, use this example below to correctly display the ``location`` field.
```js
import { runASTAnalysis } from "@nodesecure/js-x-ray";
import { readFileSync } from "fs";

const str = readFileSync("./file.js", "utf-8");
const { warnings, dependencies } = runASTAnalysis(str);

const dependenciesName = [...dependencies];
const inTryDeps = [...dependencies.getDependenciesInTryStatement()];

console.log(dependenciesName);
console.log(inTryDeps);
console.log(JSON.stringify(warnings, null, 2));
```
save content above to a ``.mjs`` file and run it with this command in your terminal``
node ./example_filename.mjs``

---

The analysis will return: `http` (in try), `crypto`, `util` and `fs`.

Expand Down

0 comments on commit 36f6589

Please sign in to comment.