update-query
v1.0.5
Published
Update the query string of a url with the given object
Downloads
887
Readme
updateQuery(url, Object)
Update the query string of a url with the given object
Installation
npm i update-query -S
alternatively:
<script src="dist/update-query.min.js"></script>
Usage
Any falsey value is omitted except
0
> updateQuery('test.com?a=1', { b: 2 })
'test.com?a=1&b=2'
> updateQuery('test.com?a=1&b=2', { a: 0, b: 3 })
'test.com?a=0&b=3'
> updateQuery('test.com?a=1&b=2', { a: '', b: null })
'test.com'
Build
npm run build
, output will be piped into dist/
Test & Coverage
npm test
& npm run cov