docs: add info about serializable types for querystring.stringify()#12313
docs: add info about serializable types for querystring.stringify()#12313shubheksha wants to merge 3 commits intonodejs:masterfrom shubheksha:docs-querystring-serializable-data-types
querystring.stringify()#12313Conversation
querystring.stringify() doesn't serialize some values. Explicitly mention what values are serialized in the docs.
addaleax
left a comment
There was a problem hiding this comment.
LGTM with a typo. Maybe it would be good to mention what happens for other input, though?
doc/api/querystring.md
Outdated
| The `querystring.stringify()` method produces a URL query string from a | ||
| given `obj` by iterating through the object's "own properties". | ||
|
|
||
| This method searializes the following types of values passed in `obj`: strings, |
There was a problem hiding this comment.
Oops, I'll fix the typo.
I'm not sure if I understand it correctly but from what I understood from the linked source code was that an empty string is returned if the param passed if not of the aforementioned types. So should I mention this implementation detail? Not sure how to frame it.
There was a problem hiding this comment.
but from what I understood from the linked source code was that an empty string is returned if the param passed if not of the aforementioned types.
That’s how I read the stringify source code, too. How about adding something like Any other input values will be coerced to empty strings?
Fix typo. Add what happens when another data type is passed to `querystring.stringify()` besides the ones that can be correctly parsed
doc/api/querystring.md
Outdated
|
|
||
| This method serializes the following types of values passed in `obj`: strings, | ||
| finite numbers, booleans and arrays of the aforementioned types. | ||
| Any other input values will be coerced to empty strings |
There was a problem hiding this comment.
I think that it is better to use the period(I'm sorry if I'm wrong because I am not native).
There was a problem hiding this comment.
You're right, thanks for pointing it out :)
doc/api/querystring.md
Outdated
| The `querystring.stringify()` method produces a URL query string from a | ||
| given `obj` by iterating through the object's "own properties". | ||
|
|
||
| This method serializes the following types of values passed in `obj`: strings, |
There was a problem hiding this comment.
Maybe this paragragh can be added to the type annotation of obj above? Using the {Type} syntax would give us links to MDN documentations. Something like
Values should be {String|Number|Boolean|String[]|Number[]|Boolean[]}
(more explanations)
There was a problem hiding this comment.
Feel free to ignore, but I would just drop the This method at the front :-)
There was a problem hiding this comment.
@joyeecheung, this is neat -- I didn't know this!
@jasnell, dropped :)
doc/api/querystring.md
Outdated
| The `querystring.stringify()` method produces a URL query string from a | ||
| given `obj` by iterating through the object's "own properties". | ||
|
|
||
| This method serializes the following types of values passed in `obj`: strings, |
There was a problem hiding this comment.
Feel free to ignore, but I would just drop the This method at the front :-)
| given `obj` by iterating through the object's "own properties". | ||
|
|
||
| It serializes the following types of values passed in `obj`: | ||
| {String|Number|Boolean|String[]|Number[]|Boolean[]} |
There was a problem hiding this comment.
Nit: if I'm not wrong primitive types should be in lowercase.
querystring.stringify() doesn't serialize some values. Explicitly mention what values are serialized in the docs. Add what happens when another data type is passed to `querystring.stringify()` besides the ones that can be correctly parsed PR-URL: nodejs#12313 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
querystring.stringify() doesn't serialize some values. Explicitly mention what values are serialized in the docs. Add what happens when another data type is passed to `querystring.stringify()` besides the ones that can be correctly parsed PR-URL: #12313 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
querystring.stringify() doesn't serialize some values. Explicitly mention what values are serialized in the docs. Add what happens when another data type is passed to `querystring.stringify()` besides the ones that can be correctly parsed PR-URL: #12313 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
querystring.stringify() doesn't serialize some values. Explicitly mention what values are serialized in the docs. Add what happens when another data type is passed to `querystring.stringify()` besides the ones that can be correctly parsed PR-URL: #12313 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
querystring.stringify() doesn't serialize some values. Explicitly mention what values are serialized in the docs. Add what happens when another data type is passed to `querystring.stringify()` besides the ones that can be correctly parsed PR-URL: #12313 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
querystring.stringify() doesn't serialize some values. Explicitly mention what values are serialized in the docs. Add what happens when another data type is passed to `querystring.stringify()` besides the ones that can be correctly parsed PR-URL: #12313 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
querystring.stringify() doesn't serialize some values. Explicitly mention what values are serialized in the docs. Add what happens when another data type is passed to `querystring.stringify()` besides the ones that can be correctly parsed PR-URL: nodejs/node#12313 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
querystring.stringify() doesn't serialize some values. Explicitly mention what values are serialized in the docs.
Fixes #12234
Checklist
Affected core subsystem(s)
doc