Classes

AbstractRoute

Utility for representing and manipulating a single route in the router's configuration.

Constants

LOOSE_SLASHES_REGEXP : RegExp

Regular expression used to match and remove the starting and trailing forward slashes from a path expression or a URL path.

AbstractRoute 

Utility for representing and manipulating a single route in the router’s configuration.

Kind: global class


new AbstractRoute(name, pathExpression, controller, view, options) 

Initializes the route.

Param Type Description
name string The unique name of this route, identifying it among the rest of the routes in the application.
pathExpression any Path expression used in route matching, to generate valid path with provided params and parsing params from current path.
controller string The full name of Object Container alias identifying the controller associated with this route.
view string The full name or Object Container alias identifying the view class associated with this route.
options Object The route additional options.

abstractRoute._name : string 

The unique name of this route, identifying it among the rest of the routes in the application.

Kind: instance property of AbstractRoute


abstractRoute._pathExpression : any 

Path expression used in route matching, to generate valid path with provided params and parsing params from current path.

Kind: instance property of AbstractRoute


abstractRoute._controller : string 

The full name of Object Container alias identifying the controller associated with this route.

Kind: instance property of AbstractRoute


abstractRoute._view : React.Component 

The full name or Object Container alias identifying the view class associated with this route.

Kind: instance property of AbstractRoute


abstractRoute._options : Object 

The route additional options.

Kind: instance property of AbstractRoute


abstractRoute.getName() ⇒ string 

Returns the unique identifying name of this route.

Kind: instance method of AbstractRoute
Returns: string - The name of the route, identifying it.


abstractRoute.getController() ⇒ string 

Returns the full name of the controller to use when this route is matched by the current URL, or an Object Container-registered alias of the controller.

Kind: instance method of AbstractRoute
Returns: string - The name of alias of the controller.


abstractRoute.getView() ⇒ string 

Returns the full name of the view class or an Object Container-registered alias for the view class, representing the view to use when this route is matched by the current URL.

Kind: instance method of AbstractRoute
Returns: string - The name or alias of the view class.


abstractRoute.getOptions() ⇒ Object 

Return route additional options.

Kind: instance method of AbstractRoute


abstractRoute.getPathExpression() ⇒ any 

Path expression used in route matching, to generate valid path with provided params and parsing params from current path.

Kind: instance method of AbstractRoute
Returns: any - The path expression.


abstractRoute.toPath([params]) ⇒ string 

Creates the URL and query parts of a URL by substituting the route’s parameter placeholders by the provided parameter value.

The extraneous parameters that do not match any of the route’s placeholders will be appended as the query string.

Kind: instance abstract method of AbstractRoute
Returns: string - Path and, if necessary, query parts of the URL representing this route with its parameters replaced by the provided parameter values.

Param Type Default Description
[params] Object.<string, (number\|string)> {} The route parameter values.

abstractRoute.matches(path) ⇒ boolean 

Tests whether the provided URL path matches this route. The provided path may contain the query.

Kind: instance abstract method of AbstractRoute
Returns: boolean - true if the provided path matches this route.

Param Type Description
path string The URL path.

abstractRoute.extractParameters(path) ⇒ Object.<string, ?string> 

Extracts the parameter values from the provided path. The method extracts both the in-path parameters and parses the query, allowing the query parameters to override the in-path parameters.

The method returns an empty hash object if the path does not match this route.

Kind: instance abstract method of AbstractRoute
Returns: Object.<string, ?string> - Map of parameter names to parameter values.

Param Type
path string

abstractRoute._getQuery(path) ⇒ Object.<string, ?string> 

Extracts and decodes the query parameters from the provided URL path and query.

Kind: instance method of AbstractRoute
Returns: Object.<string, ?string> - Parsed query parameters.

Param Type Description
path string The URL path, including the optional query string (if any).

abstractRoute._decodeURIParameter(parameterValue) ⇒ string 

Decoding parameters.

Kind: instance method of AbstractRoute
Returns: string - decodedValue

Param Type
parameterValue string

abstractRoute._getTrimmedPath(path) ⇒ string 

Trims the trailing forward slash from the provided URL path.

Kind: instance method of AbstractRoute
Returns: string - Trimmed path.

Param Type Description
path string The path to trim.

AbstractRoute.pairsToQuery([pairs]) ⇒ string 

Converts array of pairs (tuples) into valid URI query component. Filters out invalid inputs (undefined, null, object, array, non-pair).

Kind: static method of AbstractRoute
Returns: string - Valid URI query component or empty string if there are no valid pairs provided.

Param Type Default Description  
[pairs] Array.<(string\|number), any> [] Array of arrays where the first element must be string number and the second element can be any.

Example

let pairs = [['a', true], ['hello world', 123]];
pairsToQuery(pairs); // => "?a=true&hello%20world=123"

AbstractRoute.paramsToQuery(params) 

Converts object of key/value pairs to URI query, which can be appended to url.

Kind: static method of AbstractRoute

Param Type Description
params Object.<string, any> Key/value pairs.

LOOSE_SLASHES_REGEXP : RegExp 

Regular expression used to match and remove the starting and trailing forward slashes from a path expression or a URL path.

Kind: global constant