@nimpl/router
Version:
Edge router for next.js apps (i18n, basePath, rewrites, redirects)
13 lines (12 loc) • 408 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkHost = void 0;
const checkHost = (url, rule) => {
if (!rule.value)
return { match: true, groups: {} };
const match = url.host.match(`^${rule.value}$`);
if (match)
return { match: true, groups: match.groups || {} };
return { match: false, groups: {} };
};
exports.checkHost = checkHost;