MCPcopy Create free account
hub / github.com/ThatGuySam/doesitarm / getRouteType

Function getRouteType

helpers/app-derived.js:64–78  ·  view source on GitHub ↗
( routeString )

Source from the content-addressed store, hash-verified

62}
63
64export 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
80export function getIconForListing ( listing ) {
81 const routeType = getRouteType( listing.endpoint )

Callers 8

routeTypeMethod · 0.90
makeDetailsFromListingFunction · 0.90
makePagefindTitleFunction · 0.90
makePagefindContentFunction · 0.90
makePagefindFiltersFunction · 0.90
getIconForListingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected