Repository navigation
Expect to expose getDefaultVerbatim method #46919
Description
Activity
- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.
on Mar 3, 2023 Can you explain why you want to know that? I'm trying to think of reasonable use cases but I'm coming up empty-handed.
To a first approximation, as a library author, you're not expected to care. That's the responsibility of the application.
As an application programmer, you normally configure it at startup and then never change nor care about it later.
Reacted by Tobias NießenAfter I start a node service, if I use
getDefaultResultOrderto change the value ofdnsOrderor change other contents of the same file, when hot update is triggered at this time, I hope to obtain the value before and after the change through the exposed method to judge whether the order value has changed.According to the results of the above judgment, I will decide whether to update the local value printed on the terminal.
Maybe I misunderstand you but that seems of really limited utility. Why would it matter if the value changed between reloads? Is it purely a diagnostic?
Yeah, the situation I am currently encountering is mainly to compare the values before and after the change and make some changes.
However, since the logic of changing the dnsOrder value is not in the same file as the logic that requires other processing, I think it would be convenient to dynamically obtain the values before and after the change for comparison.
In addition, it suddenly occurred to me that by comparing the results of
dns.promises('localhost')anddns.promises('localhost', { verbatim: true }), it seems that it is possible to determine whether the value ofdnsOrderhas changed, but some cumbersome.I understand what you're saying now but I don't know if it passes the bar for inclusion in the standard library. Can I suggest you open a pull request and see how it's received?
I agree with Ben; I think repeatedly switching between
verbatimandipv4firstat runtime and being unable to communicate this change within the application is a very niche use case.Do you mean to open a pull request to expose the
getDefaultVerbatimmethod or expose a new methodgetDefaultResultOrder?I'll leave that up to you. What you think is best.
Ok, I created a pr exposing the method
getDefaultResultOrder. It looks like the docs also need to be updated.- added a commit that references this issue
on Apr 26, 2023 - added a commit that references this issue
on May 2, 2023 - added a commit that references this issue
on Jul 6, 2023 - added a commit that references this issue
on Jul 6, 2023
What is the problem this feature will solve?
When the
dnsOrdervalue of the dns module changes, I hope to get the modified value or judge that the value has changed. Therefore, I want to exposegetDefaultVerbatimmethod or expose a new methodgetDefaultResultOrder.node/lib/internal/dns/utils.js
Lines 278 to 280 in c4103c1
What is the feature you are proposing to solve the problem?
Judging whether dnsOrder has changed according to the exposed api.
What alternatives have you considered?
No response