(first: string, second: string)
| 628 | }) |
| 629 | |
| 630 | const 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. |
no test coverage detected