UNPKG

@nimpl/router

Version:

Edge router for next.js apps (i18n, basePath, rewrites, redirects)

14 lines (13 loc) 476 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkHeader = void 0; const checkHeader = (_url, rule, store) => { if (!rule.value) return { match: store.has(rule.key), groups: {} }; const value = store.get(rule.key); const match = value?.match(`^${rule.value}$`); if (match) return { match: true, groups: match.groups || {} }; return { match: false, groups: {} }; }; exports.checkHeader = checkHeader;