( routeString )
| 62 | } |
| 63 | |
| 64 | export function getRouteType ( routeString ) { |
| 65 | // Catch non-string routes |
| 66 | if ( typeof routeString !== 'string' ) { |
| 67 | console.warn( 'routeString is not a string', routeString ) |
| 68 | throw new Error('Route is not a string') |
| 69 | } |
| 70 | |
| 71 | // Remove first slash and split by remaining |
| 72 | // slashes to get first part of route |
| 73 | const [ routeType, , subType = null ] = routeString.substring(1).split('/') |
| 74 | |
| 75 | if ( subType === 'benchmarks' ) return 'benchmarks' |
| 76 | |
| 77 | return routeType |
| 78 | } |
| 79 | |
| 80 | export function getIconForListing ( listing ) { |
| 81 | const routeType = getRouteType( listing.endpoint ) |
no outgoing calls
no test coverage detected