React Router's nesting: a child path is relative unless it starts with `/`.
(parts: string[])
| 288 | |
| 289 | /** React Router's nesting: a child path is relative unless it starts with `/`. */ |
| 290 | function composeRoutePath(parts: string[]): string { |
| 291 | let path = ''; |
| 292 | for (const part of parts) { |
| 293 | if (part.startsWith('/')) path = part; |
| 294 | else if (part) path = `${path.replace(/\/+$/, '')}/${part}`; |
| 295 | } |
| 296 | return ('/' + path.replace(/^\/+/, '')).replace(/\/{2,}/g, '/').replace(/(.)\/$/, '$1'); |
| 297 | } |
| 298 | |
| 299 | /** |
| 300 | * The string a member expression like `paths.app.root.path` reads from a |
no outgoing calls
no test coverage detected