update-query

1.0.5 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i update-query

Weekly Downloads

374

Version

1.0.5

License

MIT

Last publish

Collaborators

  • kenberkeley