visionmedia / page.js

Micro client-side router inspired by the Express router

Home Page:http://visionmedia.github.com/page.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regex capture groups not reflected in context parameters

mclotworthy opened this issue · comments

Considering the route: /^\/inbox(?:\/?(actionable|other))?$/

A match will be made for URI: http://SomeMailServer/inbox

With expected context.params: { 0: undefined }

Currently pagejs returns an unexpected context.params of: { 0: "/inbox" }

In Route.prototype.match the loop starts from index 1 with the expectation that there will always be defined value for the first capture group. Suggest delete params[0] before beginning the loop that populates params.