Skip to content

Commit

Permalink
Allow subdomains and localhost in new domain validator (#84)
Browse files Browse the repository at this point in the history
* fix subdomain

* add localhost
  • Loading branch information
NewFuture committed Jun 10, 2022
1 parent 1ed164f commit 83dd841
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Expand Up @@ -69,7 +69,7 @@ type IReturnData<O extends Options = {}> = (IDomainData) & (IReturnCa<O>) & (IRe
export async function certificateFor<O extends Options>(requestedDomains: string | string[], options: O = {} as O): Promise<IReturnData<O>> {
const domains = Array.isArray(requestedDomains) ? requestedDomains : [requestedDomains];
domains.forEach((domain) => {
if (!isValidDomain(domain, { subdomain: false, wildcard: false, allowUnicode: true, topLevel: false })) {
if (domain !== "localhost" && !isValidDomain(domain, { subdomain: true, wildcard: false, allowUnicode: true, topLevel: false })) {
throw new Error(`"${domain}" is not a valid domain name.`);
}
});
Expand Down

0 comments on commit 83dd841

Please sign in to comment.