2.0.1 • Published 7 years ago
doctrine-file v2.0.1
Doctrine-File
File-Reader for the Doctrine JSDoc Parser
Installation
You can install Doctrine-File using npm:
$ npm install doctrine-file --save-devUsage
Import doctrine-File inside of your JavaScript:
import { parseFile, parseFileContent } from 'doctrine-file';parseFile(file, options, callback)
fileString PathName to a textfileoptionsObject- All options that doctrine.parse supports, except unwrap which can't be changed.
callbackFunction
The callback is passed two arguments (err, comments), where comments is an array of doctrine results.
If no JSDocs can be extracted from the file, the array will be empty.
When the file cannot be read err will contain the Error.
Here's a simple example:
parseFile('somefile.js', (err, comments) => {
if (err) throw err;
comments.forEach(console.log);
});parseFileContent(content, options)
contentString | Buffer Content of a complete file to be parsedoptionsObject- All options that doctrine.parse supports, except unwrap which can't be changed.
Here's a simple example:
const content = fs.readFileSync('somefile.js', 'utf-8');
const comments = parseFileContent(content);
comments.forEach(console.log);License
doctrine-file is licensed under the MIT license.