Comparing version 9.0.0 to 9.0.1
16
index.js
@@ -54,3 +54,3 @@ import {getServers} from "node:dns"; | ||
const records = {}; | ||
if (res && res.answers && res.answers.length) { | ||
if (res?.answers?.length) { | ||
for (const {name, type, data} of res.answers || {}) { | ||
@@ -64,3 +64,3 @@ if (!name || !type || !data) continue; | ||
// If CAA(X) is not empty, R(X) = CAA (X) | ||
if (records.CAA && records.CAA.length) { | ||
if (records.CAA?.length) { | ||
const caas = records.CAA.filter(record => record.name === name).map(record => record.data); | ||
@@ -71,6 +71,6 @@ if (caas.length) return caas; | ||
let alias; | ||
if (records.CNAME && records.CNAME.length) { | ||
if (records.CNAME?.length) { | ||
const dest = records.CNAME.find(record => record.name === name); | ||
alias = dest.data; | ||
} else if (records.DNAME && records.DNAME.length) { | ||
} else if (records.DNAME?.length) { | ||
const dest = records.DNAME.find(record => record.name === name); | ||
@@ -81,3 +81,3 @@ alias = name.replace(dest.name, dest.data); | ||
// If A(X) is not null, and CAA(A(X)) is not empty, then R(X) = CAA(A(X)), otherwise | ||
if (alias && records.CAA && records.CAA.length) { | ||
if (alias && records.CAA?.length) { | ||
return records.CAA.filter(record => record.name === alias && record.data).map(record => record.data); | ||
@@ -101,3 +101,3 @@ } | ||
const systemServers = getServers(); | ||
opts.servers = (systemServers && systemServers.length) ? systemServers : defaults.servers; | ||
opts.servers = systemServers?.length ? systemServers : defaults.servers; | ||
} | ||
@@ -135,6 +135,6 @@ | ||
const issueNames = caas | ||
.filter(caa => caa && caa.tag === "issue") | ||
.filter(caa => caa?.tag === "issue") | ||
.map(name => normalizeName(name.value.split(";")[0].trim())); | ||
const issueWildNames = caas | ||
.filter(caa => caa && caa.tag === "issuewild") | ||
.filter(caa => caa?.tag === "issuewild") | ||
.map(name => normalizeName(name.value.split(";")[0].trim())); | ||
@@ -141,0 +141,0 @@ |
{ | ||
"name": "caa", | ||
"version": "9.0.0", | ||
"version": "9.0.1", | ||
"description": "rfc6844-conform CAA record lookup and validation", | ||
@@ -5,0 +5,0 @@ "author": "silverwind <me@silverwind.io>", |
# caa | ||
[![](https://img.shields.io/npm/v/caa.svg?style=flat)](https://www.npmjs.org/package/caa) [![](https://img.shields.io/npm/dm/caa.svg)](https://www.npmjs.org/package/caa) | ||
[![](https://img.shields.io/npm/v/caa.svg?style=flat)](https://www.npmjs.org/package/caa) [![](https://img.shields.io/npm/dm/caa.svg)](https://www.npmjs.org/package/caa) [![](https://packagephobia.com/badge?p=caa)](https://packagephobia.com/result?p=caa) | ||
@@ -4,0 +4,0 @@ > [rfc6844](https://tools.ietf.org/html/rfc6844)-conform CAA record lookup and validation |
8119