Function getRouteParams

Retrieves the route parameters from a given pathname based on a set of routes.

  • Type Parameters

    • T = Record<string, any>

      The type of object to return as the parameters.

    Parameters

    • routes: ISwitchItem[]

      The array of route objects to search through.

    • pathname: string

      The pathname to extract the parameters from.

    Returns null | T

    • The extracted route parameters or null if no match is found.