Skip to content

crelte / std/url / urlEq

Function: urlEq()

ts
function urlEq(
   a, 
   b, 
   opts?): boolean;

Compares two URLs for equality. Normally search and hash are ignored.

If either or both url is null or undefined, the function will return false.

Example

svelte
<script>
    import { getRoute } from 'crelte';

    const route = getRoute();
</script>

<a href={item.url} class:active={urlEq($route, item.url)}>
    {item.title}
</a>

Parameters

a

| string | URL | BaseRoute | null | undefined

b

| string | URL | BaseRoute | null | undefined

opts?

hash?

boolean

boolean

Returns

boolean