I am working on a JavaScript library and trying to keep it well documented. I am structuring it in a way that I will end-up with functions for different objects, but the same name, and when adding documentation to it, it always picks up the signature for the first function and not the correct one for that object. I created a simple example for that:
`
var MyLibrary = MyLibrary || {};
MyLibrary = {
User: function (T) {
/**
* This is my User.function1
*/
this.function1 = function () {
return "1";
};
/**
* asdsa
* @returns
*/
this.function2 = function () {
return "2";
};
},
Controls: function (T) {
/**
* This is my Controls.function1
*/
this.function1 = function () {
return "1";
};
/**
* This is my Controls.function2
*/
this.function2 = function () {
return "2";
};
}
};
` When using the function MyLibrary.Controls.function1, the function name for MyLibrary.User.function1 is showing.
Am I missing something or is this because of the way I am structuring my code? any tips?
thanks

MyLibrary.Controls.function1is showing you anything at all, sinceMyLibrary.Controlsdoesn't have afunction1. (The object that would be returned bynew MyLibrary.Controlshas afunction1, but the functionMyLibrary.Controlsdoesn't.)UserandControlfunctions seem to be designed to be constructor functions. Sometimes you need to do that, but is that really the case? 3. It's not using modules.function1onMyLibrary.Controlswhen it doesn't have one, and showing the wrong docs -- as you said -- fornew MyLibrary.Controls().function1.