Conversation
|
Maybe I missed the memo but why is Array#map better than Array#forEach? Aside, mixing several style changes in a single commit is kind of meh. |
|
@bnoordhuis I tried to do as little unrelated changes as possible here and only edited one function. Basically, the code was creating a new array, and then pushing to it in a loop and returning the results which is what I think |
|
|
|
@ChALkeR care to review? |
lib/dns.js
Outdated
There was a problem hiding this comment.
Does this always return a number?
There was a problem hiding this comment.
Yes, it does. This is why I think r was confusing. It's SetServers in cares_wrap.cc which does:
args.GetReturnValue().Set(err);where err is either 0 for no error or a non-zero value for an error, where err is an int.
|
-1 to all the variable renaming. It makes this harder to review alongside the other changes. |
|
Fair enough, I'll revert all the naming changes except for |
|
I think |
lib/dns.js
Outdated
384dfdc to
3747a13
Compare
|
@ChALkeR I reverted most of the variable names as it seems people didn't like that change being included in this one. Sorry for the mess :) |
lib/dns.js
Outdated
There was a problem hiding this comment.
This is inconsistent with if (ipVersion !== 0) in two places above.
|
@ChALkeR fixed. Thanks. |
|
LGTM if the CI is happy. |
|
@benjamingr ... looks like this needs a rebase and update. |
|
Yeah, on top of my other (now landed) PR, I'll do it today and tomorrow and re-run CI, thanks :) |
aa63331 to
1a96099
Compare
1a96099 to
568b586
Compare
lib/dns.js
Outdated
There was a problem hiding this comment.
Unrelated newline? Is that accidental?
There was a problem hiding this comment.
Yeah, that's because during the rebase I'll fix it.
|
LGTM |
568b586 to
797a272
Compare
|
Looks like there's a linting issue on this: https://ci.nodejs.org/job/node-test-linter/1770/console |
|
Yeah, pushed a fix, any idea about the other issue? Is that just the build trolling? |
|
Not sure, looks like an unrelated timeout. It's the first time I've seen it tho. /cc @Trott |
|
You also pushed a |
Refactor a forEach to a `map` in the `setServers` function of the dns module - simplifying the code. In addition, use more descriptive variable names and `const` over `var` where possible. PR-URL: nodejs#5803 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
b40d64c to
669db03
Compare
|
Thanks, running a new CI https://ci.nodejs.org/job/node-test-pull-request/2024/ |
|
One failure in CI looks unrelated but can you please verify. |
|
https://ci.nodejs.org/job/node-test-binary-arm/1451/RUN_SUBSET=5,nodes=pi1-raspbian-wheezy/console @jasnell looks unrelated, pinging @nodejs/build so they see the link. |
Refactor a forEach to a `map` in the `setServers` function of the dns module - simplifying the code. In addition, use more descriptive variable names and `const` over `var` where possible. PR-URL: nodejs#5803 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
|
Landed in 4985c34 thanks! |
Refactor a forEach to a `map` in the `setServers` function of the dns module - simplifying the code. In addition, use more descriptive variable names and `const` over `var` where possible. PR-URL: #5803 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Refactor a forEach to a `map` in the `setServers` function of the dns module - simplifying the code. In addition, use more descriptive variable names and `const` over `var` where possible. PR-URL: #5803 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
|
@benjamingr this patch does not land cleanly. Would you be able to backport it? |
|
@thealphanerd I'm not sure we should backport it and in either case it's just a code cleanup. I can backport it though. I'll try to do a sweep through my PRs to master and do all the backporting to 5.x and 4.x next weekend. |
|
thanks @benjamingr |
Pull Request check-list
Affected core subsystem(s)
dns
Description of change
This is (as suggested) a more modular take on - #5762 , adding the changes one by one and making sure they're less objectionable. Making more smaller PRs.
Refactor a forEach to a
mapin thesetServersfunction of thedns module - simplifying the code. In addition, use more descriptive
variable names and
constovervarwhere possible.