extra-jsdoc-text
Version:
Utilities for processing JSDoc text.
89 lines (72 loc) ⢠2.44 kB
Markdown
Utilities for processing JSDoc text.<br>
š¦ [Node.js](https://www.npmjs.com/package/extra-jsdoc-text),
š [Web](https://www.npmjs.com/package/extra-jsdoc-text.web),
š [Files](https://unpkg.com/extra-jsdoc-text/),
š° [Docs](https://nodef.github.io/extra-jsdoc-text/).
This package is available in *Node.js* and *Web* formats. To use it on the web,
simply use the `extra_jsdoc_text` global variable after loading with a `<script>`
tag from the [jsDelivr CDN].
> Stability: [Experimental](https://www.youtube.com/watch?v=L1j93RnIxEo).
[]: https://cdn.jsdelivr.net/npm/extra-jsdoc-text.web/index.js
<br>
```javascript
const xjsdoc = require('extra-jsdoc-text');
function main() {
var txt = `
/**
* Parse jsdoc from jsdoc text.
* @param txt jsdoc text
* @returns parsed jsdoc
*/
`, parse = null;
parse = xjsdoc.parse(txt);
// {
// full: '\n' +
// '/**\n' +
// ' * Parse jsdoc from jsdoc text.\n' +
// ' * @param txt jsdoc text\n' +
// ' * @returns parsed jsdoc\n' +
// ' */\n' +
// ' ',
// description: 'Parse jsdoc from jsdoc text.\n',
// params: [
// {
// full: '@param txt jsdoc text',
// name: 'txt',
// type: '',
// description: 'jsdoc text'
// }
// ],
// returns: {
// full: '@returns parsed jsdoc',
// type: '',
// description: 'parsed jsdoc'
// },
// examples: []
// }
parse.description += ' (only if simple)';
xjsdoc.stringify(parse);
// '/**\n' +
// ' * Parse jsdoc from jsdoc text.\n' +
// ' * (only if simple)\n' +
// ' * @param txt jsdoc text\n' +
// ' * @returns parsed jsdoc\n' +
// ' * */\n'
}
main();
```
<br>
<br>
| Property | Description |
| ---- | ---- |
| [parse] | Parse jsdoc from jsdoc text. |
| [stringify] | Stringify jsdoc text from parsed jsdoc. |
<br>
<br>
[](https://www.youtube.com/watch?v=dEGrVjb2dB4)<br>
[](https://nodef.github.io)
[](https://zenodo.org/badge/latestdoi/477219250)

[]: https://nodef.github.io/extra-jsdoc-text/modules.html#parse
[]: https://nodef.github.io/extra-jsdoc-text/modules.html#stringify