To avoid using new in my JavaScript code, I write factories to create objects.
I have tried many combinations, and the one that gives me the most satisfactory result is the following:
(function () { 'use strict'; function document() { var id = function id() {...}, api = { id: id }; return api; } module.exports = document; }());
The problem with these comments is the lack of a document object. Therefore, I cannot reference this object in another object, and I cannot inherit its documentation when I extend this object.
How can such an object be documented?
If I use the @typedef tag, I get a static factory method and the document object is correctly documented but the JSDoc does not generate id method documentation:
(function () { 'use strict'; function factory(agent) { var id = function id() {...}, document = { id: id }; return document; } module.exports = factory; }());
javascript factory jsdoc
goriol
source share