(segments: string[])
| 150 | } |
| 151 | |
| 152 | function getLeafResourceSegment(segments: string[]): string { |
| 153 | const lastSegment = segments[segments.length - 1] || '' |
| 154 | if (hasFileExtension(lastSegment) && segments.length > 1) { |
| 155 | return segments[segments.length - 2] || lastSegment |
| 156 | } |
| 157 | return lastSegment |
| 158 | } |
| 159 | |
| 160 | function hasFileExtension(value: string): boolean { |
| 161 | return /\.[^/.]+$/.test(value) |
no test coverage detected