Skip to content

Instantly share code, notes, and snippets.

@jsumners
Created October 25, 2016 13:40
Show Gist options
  • Save jsumners/0c3ed95154a187fe6ee7496b7cb324ef to your computer and use it in GitHub Desktop.
Save jsumners/0c3ed95154a187fe6ee7496b7cb324ef to your computer and use it in GitHub Desktop.
jsdoc-to-markdown documenting a factory function that returns an object literal
/**
* @module foo
*/
/**
* Describe initialization
* @param {object} someInnerGlobal A context
* @return {fooFactory}
* @alias init
*/
module.exports = function init (someInnerGlobal) {
const innerGlobal = configureInnerGlobal(someInnerGlobal)
/**
* Build and return a new `foo` instance.
*
* @param {object} config Configuration context
* @return {fooType}
*/
function factory (config) {
/**
* The real object of the module.
* @alias fooType
*/
const foo = {}
/**
* Some method.
* @return {*} The result
*
* @memberof fooType
* @method method
* @static
*/
foo.method = function () {}
/**
* Another method
* @return {*} The result
*
* @memberof fooType
* @method anotherMethod
* @static
*/
foo.anotherMethod = function () {}
}
return factory
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment