@@ -278,9 +278,7 @@ export function Router({
278278 locationProp = parsePath ( locationProp ) ;
279279 }
280280
281- let {
282- pathname, search, hash, state, key
283- } = parseLocation ( locationProp )
281+ let { pathname, search, hash, state, key } = parseLocation ( locationProp ) ;
284282
285283 let location = React . useMemo ( ( ) => {
286284 let trailingPathname = stripBasename ( pathname , basename ) ;
@@ -404,41 +402,57 @@ export function useLocation(): Location {
404402/**
405403 * Returns a complete Location with an absolute pathname
406404 */
407- export function parseLocation ( { pathname = "/" , ...rest } : Partial < Location > ) : Location {
405+ export function parseLocation ( {
406+ pathname = "/" ,
407+ ...rest
408+ } : Partial < Location > ) : Location {
408409 const defaultLocation = {
409- pathname : "/" , search : "" , hash : "" ,
410- state : null , key : "default" ,
411- }
412- return { ...defaultLocation , ...rest , pathname : normalizePathnameStart ( pathname ) }
410+ pathname : "/" ,
411+ search : "" ,
412+ hash : "" ,
413+ state : null ,
414+ key : "default"
415+ } ;
416+ return {
417+ ...defaultLocation ,
418+ ...rest ,
419+ pathname : normalizePathnameStart ( pathname )
420+ } ;
413421}
414422
415423/**
416424 * Returns a modified navigator to allow relative pathnames
417425 */
418- export function useNavigator ( navigator : Navigator , basename : string ) : Navigator {
426+ export function useNavigator (
427+ navigator : Navigator ,
428+ basename : string
429+ ) : Navigator {
419430 if ( basename !== "" ) {
420- return navigator
431+ return navigator ;
421432 }
422433
423434 const makeRelative = ( path : Path ) : Path => {
424435 return {
425- ...path , pathname : path . pathname . replace ( / ^ \/ / , "" )
426- }
427- }
436+ ...path ,
437+ pathname : path . pathname . replace ( / ^ \/ / , "" )
438+ } ;
439+ } ;
428440 const push = ( to : To , state ?: any ) : void => {
429- navigator . push ( makeRelative ( resolvePath ( to ) ) , state )
430- }
441+ navigator . push ( makeRelative ( resolvePath ( to ) ) , state ) ;
442+ } ;
431443 const replace = ( to : To , state ?: any ) : void => {
432- navigator . replace ( makeRelative ( resolvePath ( to ) ) , state )
433- }
444+ navigator . replace ( makeRelative ( resolvePath ( to ) ) , state ) ;
445+ } ;
434446 const createHref = ( to : To ) : string => {
435- return navigator . createHref ( makeRelative ( resolvePath ( to ) ) )
436- }
447+ return navigator . createHref ( makeRelative ( resolvePath ( to ) ) ) ;
448+ } ;
437449
438450 return {
439451 go : navigator . go ,
440- push, replace, createHref
441- }
452+ push,
453+ replace,
454+ createHref
455+ } ;
442456}
443457
444458/**
0 commit comments