@nimpl/router
Version:
Edge router for next.js apps (i18n, basePath, rewrites, redirects)
14 lines (13 loc) • 485 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkCookie = void 0;
const checkCookie = (_url, rule, store) => {
if (!rule.value)
return { match: store.has(rule.key), groups: {} };
const cookie = store.get(rule.key);
const match = cookie?.value?.match(`^${rule.value}$`);
if (match)
return { match: true, groups: match.groups || {} };
return { match: false, groups: {} };
};
exports.checkCookie = checkCookie;