README.md

August 11, 2024 ยท View on GitHub

jsdoc-extractor

Fast JSDoc extractor with no dependencies (parsing directly from Buffer input).

version Maintenance MIT size Known Vulnerabilities githubaction

Requirements

  • Node.js v18 or higher

Getting Started

This package is available in the Node Package Repository and can be easily installed with npm or yarn.

$ npm i jsdoc-extractor
# or
$ yarn add jsdoc-extractor

Usage example

const jsdocExtractor = require("jsdoc-extractor");
const { readFileSync } = require("fs");

const buf = readFileSync("./sourceCode.js");
for (const [doc, start, end] of jsdocExtractor(buf)) {
    console.log(`Found a new JSDoc block between ${start} and ${end}`);
    console.log(doc.toString());
    console.log("-------------");
}

API

jsdocExtractor(buf: Buffer): IterableIterator< [Buffer, number, number] >

Take a buffer as Argument and return a Synchronous Iterator. The value returned by the iterator is the following:

[buffer, start, end]

Where start and end are the offset to retrieve (slice) the original Buffer.

namedescription
jsdoc-tokenizerTokenizer for JSDoc blocks

Contributors โœจ

All Contributors

Thanks goes to these wonderful people (emoji key):


Gentilhomme

๐Ÿ’ป ๐Ÿ“– ๐Ÿ› ๐Ÿ›ก๏ธ

License

MIT