@openfn/doclet-query

0.0.3 • Public • Published

doclet-query

CircleCI

JSDoc Metadata Query Tools

EXPERIMENTAL Like life itself, it's very likely to change.

Usage

  1. Get a dump of doclets from JSDoc.
    Easiest way is to use jsdoc-api.

    const jsdoc = require('jsdoc-api');
    const { createTree } = require('./src');
    
    jsdoc.explain({
      files: '../package-name/src/*',
      package: '../package-name/package.json'
    }).then(function(result) {
      const tree = createTree(result);
      console.log(tree['package-name'].modules.foo.exports)
    })

    or

    You can use the "explain" switch from the JSDoc CLI:
    jsdoc src -r -P package.json -X > doclets.json

  2. Using the jsdoc-query API call createTree with the doclets data.

const doclets = require('./doclets.json');
const { createTree } = require('doclet-query');
const tree = createTree(doclets);
  1. Starting from the package, you can traverse the module's structure:
const package = tree['package-name']        // The package
const modules = package.modules             // Modules found in the package
const exportedMembers = modules.foo.exports // Exported members of the module

Readme

Keywords

none

Package Sidebar

Install

npm i @openfn/doclet-query

Weekly Downloads

1

Version

0.0.3

License

LGPLv3

Unpacked Size

106 kB

Total Files

7

Last publish

Collaborators

  • mtuchi
  • elias-ba
  • stuartc-openfn
  • taylordowns2000