MCPcopy
hub / github.com/vercel/next.js / getDestination

Function getDestination

examples/with-zones/home/test/next-config.test.ts:9–21  ·  view source on GitHub ↗
(destination: string, pathMatch: MatchResult)

Source from the content-addressed store, hash-verified

7import nextConfig from "../next.config.js";
8
9function getDestination(destination: string, pathMatch: MatchResult): string {
10 const hasDifferentHost = destination.startsWith("https://");
11 if (hasDifferentHost) {
12 const destinationUrl = new URL(destination);
13 destinationUrl.pathname = compile(destinationUrl.pathname, {
14 encode: encodeURIComponent,
15 })(pathMatch.params);
16 return destinationUrl.toString();
17 }
18 return compile(destination, {
19 encode: encodeURIComponent,
20 })(pathMatch.params);
21}
22
23const BLOG_URL = "https://with-zones-blog.vercel.app";
24

Callers 1

getRewrittenUrlFunction · 0.85

Calls 3

compileFunction · 0.90
startsWithMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected