javascript - Correct way to document open-ended argument functions in JSDoc -



javascript - Correct way to document open-ended argument functions in JSDoc -

let's have following:

var somefunc = function() { // here arguments }

how correctly document function can take number of arguments in jsdoc? best guess, i'm not sure it's correct.

/** * @param {mixed} [...] unlimited amount of optional parameters */ var somefunc = function() { // here arguments }

related to: php - how doc variable number of parameters

i haven't been able find in jsdoc specs, it's worth...

google's closure compiler way:

@param {...number} var_args

where "number" type of arguments expected.

the finish usage of this, then, following:

/** * @param {...*} var_args */ function lookmaimvariadic(var_args) { // utilize `arguments` object here, not `var_args`. }

note comment utilizing arguments (or offset of arguments) access additional arguments. var_args used signal ide argument indeed exist.

search "variable parameters (in @param annotations)" on page see yourself: http://code.google.com/closure/compiler/docs/js-for-compiler.html

javascript jsdoc

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -