UNPKG

@nimpl/router

Version:

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

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