README: fix docs around parse() / stringify() function names#255
README: fix docs around parse() / stringify() function names#255blakeembrey merged 3 commits intojshttp:masterfrom
Conversation
Added deprecation notices for parse() and stringify() aliases.
README.md
Outdated
|
|
||
| ### cookie.parseCookie(str, options) | ||
|
|
||
| Alias: `parse()` (deprecated) |
There was a problem hiding this comment.
Can you share more context around adding the deprecated names? I can guess it’s for quick lookup from a previous version, but would like to understand more.
WDYT about making a “deprecated” section at the bottom and using that instead to point to the new methods? It could contain more information about the old function format too (three args vs one for stringify).
There was a problem hiding this comment.
I upgraded from version 1.0.2 to 1.1.1, and as I was checking the docs, was confused by the new names... it felt at first like it had been a breaking change, even though it was only a minor version update.
I didn't see that the old names were still there for several minutes (where I was searching through the commit history to find out when that "breaking change" had happened), and then found the aliases were included down at the bottom of the file.
So my goal in adding them to the documentation is to prevent others' confusion. I made the "assumption" of deprecation given the name change but if there's no intent to actually deprecate, that part could be taken out from the names.
If you're intending to deprecate (and eventually break, on a semver major) the arguments, I agree those changes should also be noted in the docs, and indeed maybe a "Deprecation" section is appropriate.
But even still, I think to prevent confusion for others, like I had, I think having some note like my "Alias: .." in each section is helpful (at least for the rest of the 1.x branch) so people upgrading can see that they used to call parse() and can still do so, but should update to the parseCookie() name, or whatever).
If you have other thoughts on how best to document, I'm happy to update the PR... or you can do so. Either way, was just trying to help others not hit my confusion. :)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #255 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 160 253 +93
Branches 69 113 +44
=========================================
+ Hits 160 253 +93 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
README.md
Outdated
|
|
||
| ### cookie.stringifyCookie(cookieObj, options) | ||
|
|
||
| Alias: `stringify()` (deprecated) |
There was a problem hiding this comment.
Needed to move this, it was serialize and the new method is stringifySetCookie (common mistake and why it was renamed when there's now two different stringify methods).
| http.createServer(onRequest).listen(3000); | ||
| ``` | ||
|
|
||
| ## Deprecated |
There was a problem hiding this comment.
I added a lightweight deprecated section and linked it, there's not a lot to include but it can be expanded in the future.
One fix here is an inconsistency where
stringify()in code example hadn't been updated to the newstringifyCookie()name of the section the example was in.The other fix is adding a note to each section (
parseCookie()andstringifyCookie()) to indicate their now-deprecated alias names.