Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by xixixao

2 days ago

Should be easy with any standard parser. See astexplorer.net

1 comment

xixixao

Reply

galaxyLogic  2 hours ago

I've been using Esprima and it's not trivial to get rid of, or collect all comments with it. The reason is that while it finds the ranges of all syntactic JavaScript elements, it does not consider comment to be a syntactic element, but just something between them.

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities