• Version 0.3.4
  • Published
  • 150 kB
  • No dependencies
  • MIT license


npm i route-recognizer
yarn add route-recognizer
pnpm add route-recognizer


A lightweight JavaScript library that matches paths against registered routes.



class RouteRecognizer

class RouteRecognizer {}



      property delegate

      delegate: Delegate;


        static ENCODE_AND_DECODE_PATH_SEGMENTS: boolean;

          property map

          map: (
          context: MatchCallback,
          addCallback?: (router: this, routes: Route[]) => void
          ) => void;

            property Normalizer

            static Normalizer: {
            normalizeSegment: (segment: string) => string;
            normalizePath: (path: string) => string;
            encodePathSegment: (str: string) => string;

              property VERSION

              static VERSION: string;

                method add

                add: (routes: Route[], options?: { as: string }) => void;

                  method generate

                  generate: (name: string, params?: Params | null) => string;

                    method generateQueryString

                    generateQueryString: (params: QueryParams) => string;

                      method handlersFor

                      handlersFor: (name: string) => any[];

                        method hasRoute

                        hasRoute: (name: string) => boolean;

                          method parseQueryString

                          parseQueryString: (queryString: string) => QueryParams;

                            method recognize

                            recognize: (path: string) => Results | undefined;


                              interface Delegate

                              interface Delegate {}

                                method contextEntered

                                contextEntered: (context: string, route: MatchDSL) => void;

                                  method willAddRoute

                                  willAddRoute: (context: string | undefined, route: string) => string;

                                    interface MatchCallback

                                    interface MatchCallback {}

                                      call signature

                                      (match: MatchDSL): void;

                                        interface Params

                                        interface Params {}

                                          property queryParams

                                          queryParams?: QueryParams | null;

                                            index signature

                                            [key: string]: Opaque;

                                              index signature

                                              [key: number]: Opaque;

                                                interface QueryParams

                                                interface QueryParams {}

                                                  index signature

                                                  [param: string]: any[] | any | null | undefined;

                                                    interface Result

                                                    interface Result {}

                                                      property handler

                                                      handler: Opaque;

                                                        property isDynamic

                                                        isDynamic: boolean;

                                                          property params

                                                          params: Params;

                                                            interface Results

                                                            interface Results extends ArrayLike<Result | undefined> {}

                                                              property queryParams

                                                              queryParams: QueryParams;

                                                                method push

                                                                push: (...results: Result[]) => number;

                                                                  method slice

                                                                  slice: (start?: number, end?: number) => Result[];

                                                                    method splice

                                                                    splice: (start: number, deleteCount: number, ...items: Result[]) => Result[];

                                                                      Package Files (2)

                                                                      Dependencies (0)

                                                                      No dependencies.

                                                                      Dev Dependencies (14)

                                                                      Peer Dependencies (0)

                                                                      No peer dependencies.


                                                                      To add a badge like this badgeto your package's README, use the codes available below.

                                                                      You may also use to create a custom badge linking to

                                                                      • Markdown
                                                                      • HTML
                                                                        <a href=""><img src="" alt=""></a>