Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Route
    • RouteUrl

Implements

Index

Constructors

Methods

Constructors

constructor

  • Represents a route

    example

    var route = new Route('/:foo/:bar');

    example

    var route = new Route('/:foo/:bar');

    Parameters

    • spec: string

    Returns RouteUrl

Methods

getRaw

  • getRaw(): string

match

  • match(pathname: string): object | false
  • Match a path against this route, returning the matched parameters if it matches, false if not.

    example

    var route = new Route('/this/is/my/route') route.match('/this/is/my/route') // -> {}

    example

    var route = new Route('/:one/:two') route.match('/foo/bar/') // -> {one: 'foo', two: 'bar'}

    Parameters

    • pathname: string

    Returns object | false

reverse

  • reverse(params: object): string | false
  • Reverse a route specification to a path, returning false if it can't be fulfilled

    example

    var route = new Route('/:one/:two') route.reverse({one: 'foo', two: 'bar'}) -> '/foo/bar'

    Parameters

    • params: object
      • [i: string]: any

    Returns string | false

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc