@fingerprintjs/url-matcher
    Preparing search index...

    Type Alias Route<Metadata>

    type Route<Metadata> = {
        hostname: string;
        metadata?: Metadata;
        path: string;
        protocol?: Protocol;
        route: string;
        specificity?: number;
        wildcardHostnamePrefix: boolean;
        wildcardPathSuffix: boolean;
    }

    Type Parameters

    • Metadata
    Index

    Properties

    hostname: string

    The hostname part of the route to match against. Can be an empty string when matching any hostname (wildcard '*'). In that instance, the matcher can leverage the fact that .endsWith() returns true for empty strings.

    metadata?: Metadata

    Extracted metadata if RouteWithMetadata was provided.

    path: string

    The path part of the route to match against, including the pathname but excluding query strings.

    protocol?: Protocol

    The protocol part of the route. Can be either https: or http. If undefined, the route matches any protocol.

    route: string

    The original route string that was parsed to create this Route object. Contains the full route pattern as originally provided, including any protocols, wildcards, hostnames, and paths. Used for reference and sorting when routes have equal specificity.

    specificity?: number

    A numeric value representing how specific this route is for matching purposes. Higher values indicate more specific routes. Calculated as (hostScore * 26 + pathScore) where hostScore is the number of hostname parts (subdomains) and pathScore is the number of path segments. Wildcard prefixes in hostname and wildcard suffixes in path reduce their respective scores by 2. Used for sorting routes so more specific routes are matched first.

    wildcardHostnamePrefix: boolean

    Whether the hostname allows wildcard prefix matching. When true, the route matches any hostname that ends with the specified hostname. For example, if hostname is "example.com" and this is true, it matches "sub.example.com".

    wildcardPathSuffix: boolean

    Whether the path allows wildcard suffix matching. When true, the route matches any path that starts with the specified path. For example, if path is "/api" and this is true, it matches "/api/users".