make-url
v0.0.1
Published
Url maker
Downloads
585
Maintainers
Readme
make-url
Install
$ npm install --save make-url
Usage
var makeUrl = require('make-url');
// only params
makeUrl('/example/:foo/:bar', { foo: 'one', bar: 'two' })
//=> /example/one/two
// params and query
makeUrl('/example/:foo/:bar', { foo: 'one', bar: 'two' }, { time: 'stop' })
//=> /example/one/two?time=stop
// params as arguments
makeUrl('/example/:foo/:bar', 'one', 'two')
//=> /example/one/two
// only query
makeUrl('/example', { time: 'stop' })
//=> /example?time=stop
// params as arguments and query
makeUrl('/example/:foo/:bar', 'one', 'two', { time: 'stop' })
//=> /example/one/two?time=stop