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

Function joinSegments

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

Source from the content-addressed store, hash-verified

628})
629
630const joinSegments = (first: string, second: string): string => {
631 const endsWithSlash = first.endsWith("/")
632 const startsWithSlash = second.startsWith("/")
633 const needsTrim = endsWithSlash && startsWithSlash
634 const needsSlash = !endsWithSlash && !startsWithSlash
635 return needsTrim ?
636 first + second.slice(1) :
637 needsSlash ?
638 first + "/" + second :
639 first + second
640}
641
642/**
643 * Updates the request URL by applying a function to the current URL string.

Callers 1

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected