dns: Refactor forEach to map
Pull Request check-list
Affected core subsystem(s)
dns
Description of change
This is (as suggested) a more modular take on - https://github.com/nodejs/node/pull/5762/ , adding the changes one by one and making sure they're less objectionable. Making more smaller PRs.
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.