Created
March 31, 2016 08:46
-
-
Save ishan-marikar/459abf3c240ae27d276807effc6da247 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| let dns = require('dns'), | |
| Promise = require('bluebird'), | |
| resolve = Promise.promisify(dns.resolve), | |
| _ = require('lodash'); | |
| function dnsRecords(addr) { | |
| const rrtypes = ['A', 'MX']; | |
| let promises = rrtypes.map(rrtype => resolve(addr, rrtype)); | |
| return Promise.all(promises) | |
| .then((responses) => { | |
| return _.zipObject(rrtypes, responses); | |
| }); | |
| } | |
| module.exports = dnsRecords; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment