-
-
Notifications
You must be signed in to change notification settings - Fork 2
Description
If file has some class and function that returns an instance of this class then it should export not only function but also class itself. Otherwise, metadoc
won't be able to generate documentation for this class. And documentation should be generated because it will be confusing to have docs for the function that returns the class instance but don't have documentation for that class. For example:
// Class description
class SomeClass {
// constructor description
constructor() {}
// Method description
method() {}
}
// Get SomeClass instance
// Returns: <SomeClass>
const getSomeClassInstance = () => new SomeClass();
module.exports = { getSomeClassInstance };
/cc @tshemsedinov @belochub @nechaido @lundibundi
Edit: Examples can be found here:
metasync
https://github.com/metarhia/metasync/blob/master/lib/chain.js
https://github.com/metarhia/metasync/blob/master/lib/collector.class.js
https://github.com/metarhia/metasync/blob/master/lib/collector.functor.js
https://github.com/metarhia/metasync/blob/master/lib/collector.js
https://github.com/metarhia/metasync/blob/master/lib/composition.js
https://github.com/metarhia/metasync/blob/master/lib/memoize.js
https://github.com/metarhia/metasync/blob/master/lib/queue.js
common
https://github.com/metarhia/common/blob/master/lib/cache.js
https://github.com/metarhia/common/blob/master/lib/events.js
https://github.com/metarhia/common/blob/master/lib/iterator.js
metaschema
https://github.com/metarhia/metaschema/blob/master/lib/schema.js
metalog
https://github.com/metarhia/metalog/blob/master/metalog.js