mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Catch non string routes
This commit is contained in:
parent
ac90bf1a24
commit
8234d61214
1 changed files with 6 additions and 0 deletions
|
|
@ -57,6 +57,12 @@ export function getVideoEndpoint ( video ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRouteType ( routeString ) {
|
export function getRouteType ( routeString ) {
|
||||||
|
// Catch non-string routes
|
||||||
|
if ( typeof routeString !== 'string' ) {
|
||||||
|
console.warn( 'routeString is not a string', routeString )
|
||||||
|
throw new Error('Route is not a string')
|
||||||
|
}
|
||||||
|
|
||||||
// Remove first slash and split by remaining
|
// Remove first slash and split by remaining
|
||||||
// slashes to get first part of route
|
// slashes to get first part of route
|
||||||
const [ routeType ] = routeString.substring(1).split('/')
|
const [ routeType ] = routeString.substring(1).split('/')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue