MCPcopy Index your code
hub / github.com/Effect-TS/effect / compilePath

Function compilePath

packages/platform/src/HttpApiClient.ts:397–414  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

395const paramsRegex = /:(\w+)\??/g
396
397const compilePath = (path: string) => {
398 const segments = path.split(paramsRegex)
399 const len = segments.length
400 if (len === 1) {
401 return (_: any) => path
402 }
403 return (params: Record<string, string>) => {
404 let url = segments[0]
405 for (let i = 1; i < len; i++) {
406 if (i % 2 === 0) {
407 url += segments[i]
408 } else {
409 url += params[segments[i]]
410 }
411 }
412 return url
413 }
414}
415
416const schemaToResponse = (
417 ast: AST.AST

Callers 1

onEndpointFunction · 0.85

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected