Promises - jsdoc2md/jsdoc-to-markdown GitHub Wiki
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.
-
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 () {}
-
Produces output like this:
Promise
getSomething() ⇒ 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.