krakenjs/reverend — pull request #2 by ericf (2014-06-12 21:10:43+00:00)
Title: Implement all path-to-regexp features

I was looking to revamp our [`pathTo()` helper function](https://github.com/yahoo/express-map/blob/a3c5be22f0f277d80453f4338a925d5d4ede8743/lib/pathto.js) — which generates URLs from a route + context object — to make it standalone and work with `path-to-regexp`. Then I found this :smile:

I noticed the current implementation of this package uses an older version of `path-to-regexp`, it doesn't support unnamed params, or routes like `/posts/:id(\\d+)`, so I decided to revamp this package to do those things and more.

### The PR has the following changes:

* Bump `path-to-regexp` to `v0.2.x`.
* Validate `route` input to make sure it's a String.
* Add support for [Custom Match](https://github.com/component/path-to-regexp#custom-match-parameters) and [Unnamed](https://github.com/component/path-to-regexp#unnamed-parameters) parameters.
* Validate that the generated path (return value) will in fact match the original `route`.

The tests have been updated and the coverage numbers are still at 100%.

### Throwing Errors

I'm curious to get your opinion on my changes to make this package throw errors. I felt that it was better to throw errors so developers know when URLs are being generated that their app's won't actually be able to handle.

----

**Let me know what you think…**