test: change to arrow functions in send-bad-arguments#23483
test: change to arrow functions in send-bad-arguments#23483annatangzhao wants to merge 1 commit intonodejs:masterfrom
Conversation
| const host = '127.0.0.1'; | ||
| const sock = dgram.createSocket('udp4'); | ||
|
|
||
| assert.throws(function() { |
There was a problem hiding this comment.
Since the function contains only one statement, the curly brackets are not required here and other places in the code.
That means, () => { sock.send(); } can be () => sock.send()
There was a problem hiding this comment.
In my opinion, the brackets should not be removed in this situation. They should only be removed if the arrow function is explicitly returning a value (in my opinion).
There was a problem hiding this comment.
In other words:
() => { return foo(); } should be changed to () => foo(); but () => { foo(); } should be left as-is, in my opinion. Otherwise, someone reading the code is left wondering if the fact that the arrow function is returning a value is a result of the author wanting to omit the brackets for the sake of omitting the brackets or if it's because the function is meant to return a value.
|
Landed in 6783eed |
PR-URL: nodejs#23483 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
PR-URL: #23483 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
PR-URL: #23483 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
PR-URL: #23483 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
PR-URL: #23483 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
PR-URL: #23483 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Part of Code and Learn workshop at Node + JS Interactive!
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes