-
Notifications
You must be signed in to change notification settings - Fork 983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jsdoc comments #836
jsdoc comments #836
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,13 @@ | |
var shallowCopy = require('./utils').shallowCopy; | ||
|
||
|
||
/** | ||
* creates a HttpClient or a flavor of it. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A flavor? What kind of flavour? Watermelon? Mint? All kidding aside, might be worth elaborating on what that is. |
||
* @public | ||
* @function createClient | ||
* @param {Object} options an options object | ||
* @returns {HttpClient | JsonClient | StringClient} | ||
*/ | ||
function createClient(options) { | ||
if (typeof (options) === 'string') { | ||
options = { | ||
|
@@ -51,6 +58,13 @@ function createClient(options) { | |
} | ||
|
||
|
||
/** | ||
* creates a json httpclient. | ||
* @public | ||
* @function createJsonClient | ||
* @param {Object} options an options object | ||
* @returns {JsonClient} a json client | ||
*/ | ||
function createJsonClient(options) { | ||
if (typeof (options) === 'string') { | ||
options = { | ||
|
@@ -64,6 +78,13 @@ function createJsonClient(options) { | |
} | ||
|
||
|
||
/** | ||
* creates a string httpclient. | ||
* @public | ||
* @function createStringClient | ||
* @param {Object} options an options object | ||
* @returns {StringClient} a string client | ||
*/ | ||
function createStringClient(options) { | ||
if (typeof (options) === 'string') { | ||
options = { | ||
|
@@ -77,6 +98,13 @@ function createStringClient(options) { | |
} | ||
|
||
|
||
/** | ||
* creates a regular httpclient. | ||
* @public | ||
* @function createHttpClient | ||
* @param {Object} options an options object | ||
* @returns {HttpClient} an http client | ||
*/ | ||
function createHttpClient(options) { | ||
if (typeof (options) === 'string') { | ||
options = { | ||
|
@@ -90,6 +118,13 @@ function createHttpClient(options) { | |
} | ||
|
||
|
||
/** | ||
* creates a server. | ||
* @public | ||
* @function createServer | ||
* @param {Object} options an options object | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as a TODO, once the new docs are in place, we should link to them from within the jsdocs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I experimented with generating the JSDocs, but they're super wonky, and there are lots of corner cases which are less than ideal. My instinct is to keep the JSDoc comments in place purely for developer use (which is always good), and continue to shore up user docs as a separate thing. |
||
* @returns {Server} | ||
*/ | ||
function createServer(options) { | ||
var bunyan = require('./bunyan_helper'); | ||
var InternalError = require('./errors').InternalError; | ||
|
@@ -123,8 +158,11 @@ function createServer(options) { | |
* parameters filled in by the passed hash. | ||
* | ||
* If a key is not found in the hash for a param, it is left alone. | ||
* | ||
* @param {Object} a hash of parameter names to values for substitution. | ||
* @public | ||
* @function realizeUrl | ||
* @param {String} pattern a url string | ||
* @param {Object} params a hash of parameter names to values for substitution | ||
* @returns {String} | ||
*/ | ||
function realizeUrl(pattern, params) { | ||
var p = pattern.replace(/\/:([^/]+)/g, function (match, k) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the blessed way to doc a complex object? I had thought it was something like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the JSDoc docs:
So it should probably be documented as @yunong proposed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, that was an existing comment block, so I didn't look too closely. I'll fix it up as proposed.