0

I have a function operation that takes two arguments str (a String) and fn (a Function).

function operation(str, fn){
  var temp = {}
  temp[str] = fn
  return temp
}
  • How do you describe this return value?
  • What does this return value look like in JSDoc?
  • What is the example output format?

Is this acceptable for the @return description?

@returns {Object} With one key set to str and one value set to fn.

Is this acceptable for the @example output?

operation("foo", console.log)
// => {"foo": [Function]}

The main reason I ask is because I would like to use this format to test the function within a suite like yamadapc/jsdoctest.

ThomasReggi
  • 42,912
  • 63
  • 199
  • 343

1 Answers1

0

In my opinion, you should use both of them.For exampe,in underscorejs, doc is describe as fellow: enter image description here