Build and prepare URLs for use with Express and Restify routing.
This module exposes two functions:
Given a URL in the Express/Restify format replace the tokens with the values provided in the tokens object.
The third param (prepUrl) defaults to false but if set to true will pass the URL to the prepUrl function before before it is tokenised.
Given a URL and tokens object if the key from the tokens object does not already exist in the URL add a new token to the query string, eg:
url: /fruit/:id
params: { id: 123, page: 3 }
Prep url would change the url to:
/fruit/:id?page=:page
and then prepUrl would turn that into:
/fruit/123?page=3