typings: add typing for string decoder#38229
Conversation
lib/string_decoder.js
Outdated
| /** | ||
| * | ||
| * @param {string} enc | ||
| * @returns {"utf8" | "utf16le" | "hex" | "ascii" | "base64" | "latin1" | "base64url"} |
There was a problem hiding this comment.
| * @returns {"utf8" | "utf16le" | "hex" | "ascii" | "base64" | "latin1" | "base64url"} | |
| * @returns {"utf8" | "utf16le" | "hex" | "ascii" | |
| * | "base64" | "latin1" | "base64url"} |
What about this?
Co-authored-by: Michaël Zasso <targos@protonmail.com>
marsonya
left a comment
There was a problem hiding this comment.
I would suggest adding function descriptions in the jsdoc comments.
| }; | ||
|
|
||
| /** | ||
| * |
There was a problem hiding this comment.
| * | |
| * Returns any remaining input stored in the internal buffer as a string. | |
| * After end() is called, the stringDecoder object can be reused for new input. |
| // buffers into a series of JS strings without breaking apart multi-byte | ||
| // characters. | ||
| /** | ||
| * |
There was a problem hiding this comment.
Move the above description inside the comment?
| } | ||
|
|
||
| /** | ||
| * |
There was a problem hiding this comment.
| * | |
| * Returns a decoded string, omitting any incomplete multibyte | |
| * characters at the end of the Buffer, or TypedArray, or DataView |
Co-authored-by: marsonya <akhil.marsonya27@gmail.com>
marsonya
left a comment
There was a problem hiding this comment.
Mark optional params as such and assign default value using JSDoc conventions.
Kindly ignore it incase this is too much detailing. I know we don't want to duplicate the documentation here using JSDoc. I just feel that it would be important information for core developers to know whether a param is optional or not and what it's default value would be.
|
Good idea, I will address optional arugment issue |
Co-authored-by: Akhil Marsonya <akhil.marsonya27@gmail.com>
Commit Queue failed- Loading data for nodejs/node/pull/38229 ✔ Done loading data for nodejs/node/pull/38229 ----------------------------------- PR info ------------------------------------ Title typings: add typing for string decoder (#38229) Author Qingyu Deng (@Ayase-252) Branch Ayase-252:feature/typing-lib-internal-cipher -> nodejs:master Labels string_decoder, typings, commit-queue-squash Commits 4 - typings: add typing for internal/string_decoder - fixup: typings: add typing for internal/string_decoder - fixup: add function description - fixup: mark optional parameters Committers 1 - Qingyu Deng PR-URL: https://github.com/nodejs/node/pull/38229 Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/38229 Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel -------------------------------------------------------------------------------- ℹ This PR was created on Tue, 13 Apr 2021 15:40:00 GMT ✔ Approvals: 2 ✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/38229#pullrequestreview-640365320 ✔ - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/38229#pullrequestreview-842115810 ✔ Last GitHub CI successful ✖ No Jenkins CI runs detected -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/1639087835 |
|
Landed in a100a93 |
PR-URL: #38229 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: #38229 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#38229 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: #38229 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This PR adds some JSDoc typings for internal/string_decoder.
Screenshots from my VS code:
normalizeEncodingStringDecoderStringDecoder.prototype.writeStringDecoder.prototype.endStringDecoder.prototype.text