https://github.com/kenberkeley/update-query
Update the query string of a url with the given object
https://github.com/kenberkeley/update-query
qs querystring
Last synced: 11 months ago
JSON representation
Update the query string of a url with the given object
- Host: GitHub
- URL: https://github.com/kenberkeley/update-query
- Owner: kenberkeley
- Created: 2016-12-27T11:50:56.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-21T06:29:12.000Z (almost 9 years ago)
- Last Synced: 2025-02-15T03:12:23.471Z (11 months ago)
- Topics: qs, querystring
- Language: JavaScript
- Size: 6.84 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# updateQuery(url, Object)
[![npm version][npm-v-img]][npm-url]
[![npm download][npm-dl-img]][npm-url]
[![build][build-img]][build-url]
> Update the query string of a url with the given object
### Installation
`npm i update-query -S`
> alternatively:``
### 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`
[npm-url]: https://www.npmjs.com/package/update-query
[npm-v-img]: http://img.shields.io/npm/v/update-query.svg
[npm-dl-img]: http://img.shields.io/npm/dm/update-query.svg
[build-img]: https://travis-ci.org/kenberkeley/update-query.svg?branch=master
[build-url]: https://travis-ci.org/kenberkeley/update-query