0.0.10 • Published 4 years ago

@geut/jsdast v0.0.10

Weekly downloads
21
License
MIT
Repository
github
Last release
4 years ago

jsdast

Syntax tree JSDoc based on Unist spec

Build Status JavaScript Style Guide standard-readme compliant

Made by GEUT

Install

$ npm install @geut/jsdast

Usage

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. 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.

License

MIT © A GEUT project

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago