Michael Black Michael Black - 2 months ago 40
Javascript Question

Node.JS extracting class comments

I have a Node.JS project that I'm working on, and a very specific feature of it needs to read all of the JS files in a directory, extract their class comments (possibly class name too), then store this information in an array of objects to later convert into markdown.

My question is what's the best way to extract these components such as class names and class comments?

I've thought about reading the file and parsing the syntax, but why reinvent the wheel? If there are good tools for extracting specific comments, or clever algorithms of parsing the JS file, I'd like to hear them. Thanks!