path-params
Build URL with path params
Install
yarn add @maruware/path-params
Usage
import pathParams from '@maruware/path-params'
const path = pathParams('/users/:id/messages/:message_id', {id: 2, message_id: 'abc'})
// '/users/2/messages/abc'
- with transform to snake case
import pathParams from '@maruware/path-params'
const path = pathParams('/users/:id/messages/:message_id', {id: 2, messageId: 'abc'}, {toSnake: true})
// '/users/2/messages/abc'