@a11ywatch/core
Version:
a11ywatch central API
24 lines • 875 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.domainNameFind = exports.domainName = void 0;
const domainName = (domain) => {
let base = domain === null || domain === void 0 ? void 0 : domain.split(".");
const tldMatch = (base === null || base === void 0 ? void 0 : base.length) >= 2;
if (tldMatch) {
base.pop();
}
return base && tldMatch ? base[base.length - 1] : domain;
};
exports.domainName = domainName;
const domainNameFind = (params, domain) => {
return {
$or: [
Object.assign(Object.assign({}, params), { domain: {
$regex: new RegExp((0, exports.domainName)(domain)),
} }),
Object.assign(Object.assign({}, params), { domain }),
],
};
};
exports.domainNameFind = domainNameFind;
//# sourceMappingURL=domain-name.js.map
;