In dynamic languages like JavaScript or PHP it is common practise to pass only one argument to the function. This argument is an object which encapsulate all options. What is the best way of documenting these options with ScriptDoc (or similar)?
Using JSDoc it can be done as follows:
/**
* @param {Object} o Object containing function params.
* @param {String} o.bar Example String param.
* @param {Number} o.baz Example Number param.
*/
function foo(o) {
}
More information can be found in the Parameters with Properties section of JSDoc's TagParam documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With