*Add isPromise to util

This commit is contained in:
Derrick Hammer 2022-08-18 20:10:00 -04:00
parent 64caf6c006
commit 171791d491
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 7 additions and 0 deletions

View File

@ -54,3 +54,10 @@ export function resolveSuccess(records: DNSRecord[]): DNSResult {
export function normalizeDomain(domain: string): string { export function normalizeDomain(domain: string): string {
return domain.replace(/^\.+|\.+$/g, "").replace(/^\/+|\/+$/g, ""); return domain.replace(/^\.+|\.+$/g, "").replace(/^\/+|\/+$/g, "");
} }
export function isPromise(obj: Promise<any>) {
return (
!!obj &&
(typeof obj === "object" || typeof obj === "function") &&
typeof obj.then === "function"
);
}