npm.io
1.0.5 • Published 9 years ago

update-query

Licence
MIT
Version
1.0.5
Deps
2
Vulns
0
Weekly
0
Stars
2

updateQuery(url, Object)

npm version npm download build

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

Keywords