MCPcopy
hub / github.com/TanStack/router / executeRewriteInput

Function executeRewriteInput

packages/router-core/src/rewrite.ts:63–76  ·  view source on GitHub ↗
(
  rewrite: LocationRewrite | undefined,
  url: URL,
)

Source from the content-addressed store, hash-verified

61/** Execute a location input rewrite if provided. */
62/** Execute a location input rewrite if provided. */
63export function executeRewriteInput(
64 rewrite: LocationRewrite | undefined,
65 url: URL,
66): URL {
67 const res = rewrite?.input?.({ url })
68 if (res) {
69 if (typeof res === 'string') {
70 return new URL(res)
71 } else if (res instanceof URL) {
72 return res
73 }
74 }
75 return url
76}
77
78/** Execute a location output rewrite if provided. */
79/** Execute a location output rewrite if provided. */

Callers 4

parseMethod · 0.90
RouterCoreClass · 0.90
handleServerRoutesFunction · 0.90
composeRewritesFunction · 0.85

Calls 1

inputMethod · 0.65

Tested by

no test coverage detected