url-params-appender
A library that builds a URL, adding query parameters, taking priority params into account. This is for very usefull when you want to rebuild the current URL, but add/replace the 'page' and 'pageSize'
Installation
To install with npm:
npm i url-params-appender --save
Usage
Usage with node:
var buildUrl = require('url-params-appender');
buildUrl('https://go/see',
{
page: 1,
bbb: 111,
ccc: 'val'
},
{
page:2,
pageSize:5
}
);
// returns https://go/see?page=2&bbb=111&ccc=val&pageSize=5
Now also support for query params in baseUrl:
var buildUrl = require('url-params-appender');
buildUrl('https://go/see?name=john',
{
page: 1,
bbb: 111,
ccc: 'val'
},
{
page:2,
pageSize:5
}
);
// returns https://go/see?name=john&page=2&bbb=111&ccc=val&pageSize=5
Release
How to release:
npm version (major/minor/patch)
git push origin ${tag}
Contribution
If you want to contribute to this project, you can fork the repository and create pull request to have it reviewed by the Sandbox team. Make sure to link the PR to an issue or improvement for tracking purposes.
License
This is licensed under an MIT License. See details