route-recognizer

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

Install

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

Overview

A lightweight JavaScript library that matches paths against registered routes.

Index

Classes

class RouteRecognizer

class RouteRecognizer {}

    constructor

    constructor();

      property delegate

      delegate: Delegate;

        property ENCODE_AND_DECODE_PATH_SEGMENTS

        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;

                              Interfaces

                              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.

                                                                      Badge

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

                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/route-recognizer.

                                                                      • Markdown
                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/route-recognizer)
                                                                      • HTML
                                                                        <a href="https://www.jsdocs.io/package/route-recognizer"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>