diff --git a/src/util.ts b/src/util.ts index 829ace4..dfc09a2 100644 --- a/src/util.ts +++ b/src/util.ts @@ -54,3 +54,10 @@ export function resolveSuccess(records: DNSRecord[]): DNSResult { export function normalizeDomain(domain: string): string { return domain.replace(/^\.+|\.+$/g, "").replace(/^\/+|\/+$/g, ""); } +export function isPromise(obj: Promise) { + return ( + !!obj && + (typeof obj === "object" || typeof obj === "function") && + typeof obj.then === "function" + ); +}