Files
klz-cables.com/.pnpm-store/v10/files/b5/abf7ec7a8e29733a00b215cab59bc38cdd566e26241a7e2fce5b40b1185d2e6e530690937fde4941bfa697f292024e53cfd1926dd5341f0e7bcacabe89f02e
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

29 lines
768 B
Plaintext

import { pathToRegexp } from 'path-to-regexp';
export const isPathMatchingRoute = ({
currentRoute,
exact,
path: viewPath,
sensitive,
strict
}) => {
// if no path is defined, we cannot match it so return false early
if (!viewPath) {
return false;
}
const keys = [];
// run the view path through `pathToRegexp` to resolve any dynamic segments
// i.e. `/admin/custom-view/:id` -> `/admin/custom-view/123`
const regex = pathToRegexp(viewPath, keys, {
sensitive,
strict
});
const match = regex.exec(currentRoute);
const viewRoute = match?.[0] || viewPath;
if (exact) {
return currentRoute === viewRoute;
}
if (!exact) {
return viewRoute.startsWith(currentRoute);
}
};
//# sourceMappingURL=isPathMatchingRoute.js.map