yamadapc / jsdoctest

Run jsdoc examples as doctests.
https://yamadapc.github.io/jsdoctest
MIT License
93 stars 9 forks source link

Support async somehow #8

Closed yamadapc closed 9 years ago

yamadapc commented 9 years ago

There's probably a way to support async calls, with a clean API. Something like:

/**
 * @example
 *     something('here', cb)
 *     // async => Error('Yields an error with "here"')
 *     something('there', cb)
 *     // async => 'result'
 */

function something(arg, cb) {
  if(arg === 'here') {
    cb(new Error('Yields an error with "here"');
  }
  else {
    cb(null, 'result');
  }
}