interpolate-url

0.0.2 • Public • Published

interpolate-url

Build Status

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

Package Sidebar

Install

npm i interpolate-url

Weekly Downloads

6

Version

0.0.2

License

MIT

Last publish

Collaborators

  • supercrabtree