UNPKG

542 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.resolveMxRecords = void 0;
4const dns_1 = require("dns");
5async function resolveMxRecords(domain) {
6 const records = await dns_1.promises.resolveMx(domain);
7 records.sort((a, b) => {
8 if (a.priority < b.priority) {
9 return -1;
10 }
11 if (a.priority > b.priority) {
12 return 1;
13 }
14 return 0;
15 });
16 return records.map((record) => record.exchange);
17}
18exports.resolveMxRecords = resolveMxRecords;