From 5ba533f83117316486a55f097a764dac9e7c140a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=A3=E9=87=8C=E5=A5=BD=E8=84=8F=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5?= <453491931@qq.com> Date: Wed, 8 Nov 2023 23:05:20 +0800 Subject: [PATCH] chore: fix jsdoc and typo (#1662) --- AUTHORS | 1 + docs/koa-vs-express.md | 4 ++-- lib/request.js | 4 ++-- lib/response.js | 15 +++++++++------ 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/AUTHORS b/AUTHORS index d2d048818..a44b8375a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -29,6 +29,7 @@ Fangdun Cai Felix Becker Filip Skokan Francisco Presencia +Gao Sheng George Chung Gilles De Mey Grand diff --git a/docs/koa-vs-express.md b/docs/koa-vs-express.md index f32c54193..09160f07b 100644 --- a/docs/koa-vs-express.md +++ b/docs/koa-vs-express.md @@ -39,7 +39,7 @@ ## Does Koa replace Connect? No, just a different take on similar functionality - now that generators allow us to write code with less + now that generators allow us to write code with fewer callbacks. Connect is equally capable, and some may still prefer it, it's up to what you prefer. @@ -51,7 +51,7 @@ the entire application, so we thought it would be more appropriate to create a new library. -## How is Koa different than Connect/Express? +## How is Koa different from Connect/Express? ### Promises-based control flow diff --git a/lib/request.js b/lib/request.js index 71d2779c7..850ffbe9f 100644 --- a/lib/request.js +++ b/lib/request.js @@ -376,7 +376,7 @@ module.exports = { /** * Return parsed Content-Length when present. * - * @return {Number} + * @return {Number|void} * @api public */ @@ -503,7 +503,7 @@ module.exports = { /** * Set accept object. * - * @param {Object} + * @param {Object} obj * @api private */ diff --git a/lib/response.js b/lib/response.js index a3ec20112..f9303f7d0 100644 --- a/lib/response.js +++ b/lib/response.js @@ -288,7 +288,10 @@ module.exports = { /** * Set Content-Disposition header to "attachment" with optional `filename`. * - * @param {String} filename + * @param {String} [filename] + * @param {object} [options] + * @param {string} [options.type=attachment] + * @param {string|boolean} [options.fallback=true] * @api public */ @@ -328,7 +331,7 @@ module.exports = { * this.response.lastModified = new Date(); * this.response.lastModified = '2013-09-13'; * - * @param {String|Date} type + * @param {String|Date} val * @api public */ @@ -357,7 +360,7 @@ module.exports = { * this.response.etag = '"md5hashsum"'; * this.response.etag = 'W/"123456789"'; * - * @param {String} etag + * @param {String} val * @api public */ @@ -460,7 +463,7 @@ module.exports = { * this.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' }); * * @param {String|Object|Array} field - * @param {String} val + * @param {*} val * @api public */ @@ -490,7 +493,7 @@ module.exports = { * ``` * * @param {String} field - * @param {String|Array} val + * @param {*} val * @api public */ @@ -509,7 +512,7 @@ module.exports = { /** * Remove header `field`. * - * @param {String} name + * @param {String} field * @api public */