eres icon indicating copy to clipboard operation
eres copied to clipboard

Allow option to return an empty object on error

Open vjpr opened this issue 8 years ago • 0 comments

Instead of this:

  const [e, res] = await eres(dnsLookup(domain))
  if (e) throw e
  const {address, family} = res

You could do this:

  const [e, {address, family}] = await eres(dnsLookup(domain), {returnObject: true})
  if (e) throw e

Or maybe something like:

eres.obj(dnsLookup(domain))

Otherwise its trying to destructure a null when there is an error.

What are your thoughts?

vjpr avatar Nov 22 '17 17:11 vjpr