MCPcopy Create free account
hub / github.com/Effect-TS/effect / joinSegments

Function joinSegments

packages/effect/src/unstable/http/HttpClientRequest.ts:501–511  ·  view source on GitHub ↗
(first: string, second: string)

Source from the content-addressed store, hash-verified

499})
500
501const joinSegments = (first: string, second: string): string => {
502 const endsWithSlash = first.endsWith("/")
503 const startsWithSlash = second.startsWith("/")
504 const needsTrim = endsWithSlash && startsWithSlash
505 const needsSlash = !endsWithSlash && !startsWithSlash
506 return needsTrim ?
507 first + second.slice(1) :
508 needsSlash ?
509 first + "/" + second :
510 first + second
511}
512
513/**
514 * Updates the request URL by applying a function to the current URL string.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected