libresolver/dist/resolverModule.js

21 lines
539 B
JavaScript
Raw Normal View History

2023-02-19 23:03:47 +00:00
import { getTld, isPromise } from "./util.js";
2022-08-19 15:53:39 +00:00
// ts-ignore
2022-08-18 14:58:17 +00:00
export class AbstractResolverModule {
resolver;
constructor(resolver) {
this.resolver = resolver;
}
getSupportedTlds() {
return [];
}
isTldSupported(domain) {
2023-02-19 23:03:47 +00:00
let supported = this.getSupportedTlds();
if (isPromise(supported)) {
return supported.then((supported) => {
return supported.includes(getTld(domain));
});
}
return supported.includes(getTld(domain));
2022-08-18 14:58:17 +00:00
}
}