I have a JS data object that just holds some static items. I'm not declaring it all in one go inside { }; I start with an empty object, and add items in one at a time. E.g:
var ScapeStuff = {};
// some generic stuff
ScapeStuff.generic = new SomeClass(...);
// water
ScapeStuff.water = new SomeClass(...);
// dirt of various moisture levels
var dry = someValue
var wet = anotherValue
// interpolate moisture...
ScapeStuff.dirt0 = new SomeClass(dry);
ScapeStuff.dirt1 = new SomeClass((dry + dry + wet) / 3);
ScapeStuff.dirt2 = new SomeClass((dry + wet + wet) / 3);
ScapeStuff.dirt3 = new SomeClass(wet);
// some other types of stuff..
// finally, export this data object
module.exports = ScapeStuff;
I'd like to doc my ScapeStuff data object with JSDoc, and replace the comment lines like // water
with JSDoc comments that describe that thing.
I could just add a giant JSDoc comment above the ScapeStuff = {}
, and use @member
to write a description for each property item, but the file could be quite long, so what I really want is to have the JSDoc comments for each property in the source right before that property.
What's the right way to have inline JSDoc comments in this situation?