place-params
v1.0.2
Published
Build URL with positional params by using javascript objects 🎰
Downloads
2
Readme
place-params
Build URL with positional params by using javascript objects :slot_machine:
Install
npm install place-params
Usage
Try it out on Repl.it
const placeParams = require('place-params')
const baseUrl = 'http://api.io/users/:userId/roles/:roleId'
const params = {
userId: 1,
roleId: 2
}
const url = placeParams(baseUrl, params)
console.log(url)
// returns: http://api.io/users/1/roles/2
License
Under MIT license.