-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
doc: fix and modernize code examples in crypto.md #10909
Conversation
Fixed basing on the previous example.
Unlike method signatures, examples mostly use camelCase.
Currently, the code throws. Fixed basing on the history.
@@ -541,7 +541,7 @@ const bob_key = bob.generateKeys(); | |||
const alice_secret = alice.computeSecret(bob_key); | |||
const bob_secret = bob.computeSecret(alice_key); | |||
|
|||
assert(alice_secret, bob_secret); | |||
assert.equal(alice_secret.toString('hex'), bob_secret.toString('hex')); |
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.
Nit: assert.strictEqual()
? Not sure if it is preferred on doc examples.
Edit: nvm fixed in next commit.
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.
Sorry for the confusion, I've tried to do it step by step and to split by topics)
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.
LGTM, thanks for splitting into multiple commits to simplify the review.
/cc @nodejs/crypto |
/cc @nodejs/documentation |
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.
OK. Will all the examples still run on 4.x?
I see no reason why they would not. |
I appreciate the breakdown of the PR into small commits, we should squash before landing, though. |
And that's 5 days and two approvals, @vsemozhetbyt you are good to land. |
* var -> const / let in crypto.md * fix error in crypto.md code example * equal -> strictEqual, == -> === in crypto.md * update estimated outputs in crypto.md * snake_case -> camelCase in crypto.md examples * concatenation -> multiline template in crypto * add missing line break in crypto code example * add missing link reference in crypto.md PR-URL: #10909 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in squashed commit 3e9c8ef |
* var -> const / let in crypto.md * fix error in crypto.md code example * equal -> strictEqual, == -> === in crypto.md * update estimated outputs in crypto.md * snake_case -> camelCase in crypto.md examples * concatenation -> multiline template in crypto * add missing line break in crypto code example * add missing link reference in crypto.md PR-URL: nodejs#10909 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* var -> const / let in crypto.md * fix error in crypto.md code example * equal -> strictEqual, == -> === in crypto.md * update estimated outputs in crypto.md * snake_case -> camelCase in crypto.md examples * concatenation -> multiline template in crypto * add missing line break in crypto code example * add missing link reference in crypto.md PR-URL: nodejs#10909 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* var -> const / let in crypto.md * fix error in crypto.md code example * equal -> strictEqual, == -> === in crypto.md * update estimated outputs in crypto.md * snake_case -> camelCase in crypto.md examples * concatenation -> multiline template in crypto * add missing line break in crypto code example * add missing link reference in crypto.md PR-URL: #10909 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* var -> const / let in crypto.md * fix error in crypto.md code example * equal -> strictEqual, == -> === in crypto.md * update estimated outputs in crypto.md * snake_case -> camelCase in crypto.md examples * concatenation -> multiline template in crypto * add missing line break in crypto code example * add missing link reference in crypto.md PR-URL: #10909 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist
Affected core subsystem(s)
doc, crypto
var
->const
/let
.equal
->strictEqual
,==
->===
.