Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma strängvärde byggs med konkatenering i stället för att matcha mönstret.
13 lines
470 B
TypeScript
13 lines
470 B
TypeScript
/**
|
|
* Whether hovering/focusing a nav link should warm its route.
|
|
*
|
|
* The link to the page you are already on has nothing to warm, and a
|
|
* hash-only or external href is not a route. Pure so it can be unit tested.
|
|
*/
|
|
export function shouldWarmNavRoute(href: string, currentPathname: string | null): boolean {
|
|
if (!href.startsWith('/')) return false
|
|
if (href.startsWith('//')) return false
|
|
const path = href.split(/[?#]/)[0]
|
|
return path !== currentPathname
|
|
}
|