yui/yui3 — pull request #999 by pdokas (2013-07-16 00:42:43+00:00)
Title: Add support for empty router regex params

Prior to this PR if you setup a route with a regex like this:

`router.route(/^\/((fnord)|(fnarf))\/(quux)$/, function (req) {`

Then an error would occur since the router assumed every group in the pattern would have a resultant match and thus be a string. However, sometimes it is useful to setup a URL pattern that has two capture groups for a single path segment. E.g. a Flickr URL might want:

`/photos/([0-9]+@N[0-9]+)|([0-9a-zA-Z-_]+)/?`

The one branch supports user IDs like 123@N00 and the other screennames.

This PR adds checking to the internal _decode method to verify that the current param in the params array is a well formed string before attempting to manipulate. Additionally, this adds tests to verify the correct behavior works as advertised.