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.
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.