interpolate-url
v0.0.2
Published
Interpolate urls containing /:colon variables
Downloads
40
Maintainers
Readme
interpolate-url
Basic api to do url interpolation using colons as the delimiter.
var interpolateUrl = require('interpolate-url');
var url = interpolateUrl('http://google.com/user/:id', {id: 10});
// url => http://google.com/user/10
var url = interpolateUrl('http://google.com/:type/:id', {type: 'car', id: 10});
// url => http://google.com/car/id
Also allows partial interpolation:
var url = interpolateUrl('http://google.com/:type/:id', {id: 10});
// url => http://google.com/:type/id