page_helpers.ts

Helpers for relating links to the current page.

view source

Declarations
#

href_is_current_page
#

page_helpers.ts view source

(href: string, url: Pick<URL, "href" | "origin" | "pathname">): boolean import {href_is_current_page} from '@fuzdev/fuz_ui/page_helpers.js';

Whether href leads to the page at url: the same origin and pathname, with a trailing slash, the query, and the hash ignored. A relative href resolves against url, as a browser resolves it.

href

a link's href, absolute or relative

type string

url

the current page's url, e.g. SvelteKit's readonly page.url

type Pick<URL, "href" | "origin" | "pathname">

returns

boolean

false for an href that isn't a valid url

Imported by
#