Skip to content

Commit

Permalink
feat: extract regex
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-lefebvre committed Jan 9, 2025
1 parent 977212b commit d7a83a8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/astro/src/core/routing/match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ export function matchAllRoutes(pathname: string, manifest: ManifestData): RouteD
return manifest.routes.filter((route) => route.pattern.test(decodeURI(pathname)));
}

const ROUTE404_RE = /^\/404\/?$/;
const ROUTE500_RE = /^\/500\/?$/;

export function isRoute404(route: string) {
const route404Pattern = /^\/404\/?$/;
return route404Pattern.test(route);
return ROUTE404_RE.test(route);
}

export function isRoute500(route: string) {
const route500Pattern = /^\/500\/?$/;
return route500Pattern.test(route);
return ROUTE500_RE.test(route);
}

/**
Expand Down

0 comments on commit d7a83a8

Please sign in to comment.