Description
I assumed this was a bug, but on looking into it, it seems deliberate:
Line 132 in 6f21671
@cjihrig you added this, I think, in 5086d6e (missing PR metadata), but it looks like you were cleaning up something from an earlier commit. Any ideas why falsey is allowed?
Its even tested:
node/test/parallel/test-dns-lookup.js
Lines 38 to 48 in 6f21671
My guess was that the intention is that if hostname
is falsy, there may be enough information in options
to return a useful value, in which case options
should be mandatory if hostname
is missing.
Except... I don't see how that can be, it looks to me you will always get no results no matter what flags you put into options
, and the tests even assert that, so... why is a falsey hostname allowed?
- Version: *
- Platform: *
- Subsystem: dns
% ./node
> dns.lookup(false, console.log)
{}
> null null 4