1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.resolveMxRecords = void 0;
|
4 | const dns_1 = require("dns");
|
5 | async 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 | }
|
18 | exports.resolveMxRecords = resolveMxRecords;
|