Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/geut/jsdast

JSDoc Abstract Syntax Tree
https://github.com/geut/jsdast

ast jsdoc tsdoc unist

Last synced: 3 months ago
JSON representation

JSDoc Abstract Syntax Tree

Awesome Lists containing this project

README

        

# jsdast
Syntax tree JSDoc based on Unist spec

[![Build Status](https://travis-ci.com/geut/jsdast.svg?token=yjuaa2ubUupz6ACajDgF&branch=main)](https://travis-ci.com/geut/jsdast)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)

[![Made by GEUT][geut-badge]][geut-url]

## Install

```
$ npm install @geut/jsdast
```

## Usage

```javascript
const unified = require('unified')
const { parser } = require('@geut/jsdast')

const tree = unified().use(parser).parse(`
/**
* @param {number} a
* @param {number} b
* @returns {number}
*/
function sum(a, b) {
return a + b
}
`)

console.log(JSON.stringify(tree, null, 2))

/*
{
"type": "Root",
"children": [
{
"type": "Module",
"name": "Index",
"doc": {
"description": "",
"tags": []
},
"children": [
{
"type": "FunctionDeclaration",
"name": "sum",
"doc": {
"tags": [
{
"tagName": "returns",
"fullText": "@returns {number}",
"typeExpression": "number"
}
]
},
"isExported": false,
"isDefaultExport": false,
"valueType": "number",
"isGenerator": false,
"isAsync": false,
"children": [
{
"type": "Parameter",
"name": "a",
"doc": {
"tags": []
},
"isRestParameter": false,
"valueType": "number",
"isOptional": false
},
{
"type": "Parameter",
"name": "b",
"doc": {
"tags": []
},
"isRestParameter": false,
"valueType": "number",
"isOptional": false
}
]
}
]
}
]
}
*/
```

## Issues

:bug: If you found an issue we encourage you to report it on [github](https://github.com/geut/jsdast/issues). Please specify your OS and the actions to reproduce it.

## Contributing

:busts_in_silhouette: Ideas and contributions to the project are welcome. You must follow this [guideline](https://github.com/geut/jsdast/blob/main/CONTRIBUTING.md).

## License

MIT © A [**GEUT**](http://geutstudio.com/) project

[geut-url]: https://geutstudio.com
[geut-badge]: https://img.shields.io/badge/Made%20By-GEUT-4f5186?style=for-the-badge&link=https://geutstudio.com&labelColor=white&logo=data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAARCABAAEADASIAAhEBAxEB/8QAGwAAAgIDAQAAAAAAAAAAAAAABAYDBQACBwH/xAA0EAACAQMBBAcGBgMAAAAAAAABAgMABBEFBhIhQRMiMVFhgcEUIzJxkbFCUmKh0fAkcuH/xAAYAQADAQEAAAAAAAAAAAAAAAABAwQCAP/EACARAAMAAwACAgMAAAAAAAAAAAABAgMRIRIxBEEiM1H/2gAMAwEAAhEDEQA/AOgVlau6xoXdgqqMkk8AKV9U2oYs0WngBRw6VhxPyFamXXoDeiz1PUbmzuujQIUKgjIqGLXnz72FSO9TikfVbi6uXWSSaWRuzixNBx3VzCepNIvgTw+hpjwv+iGr3tM6xa30F2PdP1uangRRNc70fUbi4JLIVaPskXgM/wA076Ze+2W+WwJF4MPWlNaemajI2/GvYbWVlZQHCptZqLNKLGJsKoDSY5nkKorKzlvrlYIRlm5nsA7zWX8pnv55SfikJ/emPZGDcs7m6CguTuL5DPrVf64Me2F2mzNhAg6ZTO/MsSB9BW15s1pt1GVEPRHvQ+hqbTNT9sZ0kCpIOIA5ij5ZEijaSRgqqMkmpVkb7sMuWtoV73S49L3I4B7kjq57c881BZ6vFpuoKjq7dIvYBw8PtUOqX1xcSxoJXw8mQuewVW3vX1eFR+Fcn96OLVvpFzz8kM020kp4QwIvixzVpot5Je2bSTEFw5HAY7qUKadnIymm7x/G5I+3pTsk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