Skip to content
fearandesire edited this page Jun 26, 2022 · 7 revisions

You can use custom tags in Jsdoc2md, for example @bread, @milk, @fulfil, @reject - whatever you like. Custom tags will be rendered as-written in the source comments. There is no standard way to document promises, this is one way to do it using custom tags.

  1. Use @fulfil and @reject tags:

      /**
     * Returns something.
     *
     * @returns {Promise}
     * @fulfil {string} - The data you wanted.
     * @reject {Error} - The error `name` property will be one of the following:
     *
     * - `NO_THANKS`: Computer doesn't want to.
     * - `TOO_MUCH`: Too much work, get some other app to do it.
     */
     function getSomething () {}
    
  2. Produces output like this:

getSomething() ⇒ Promise

Returns something.

Kind: global function Fulfil: string - The data you wanted. Reject: Error - The error name property will be one of the following:

NO_THANKS: Computer doesn't want to. TOO_MUCH: Too much work, get some other app to do it.

Clone this wiki locally