{"_id":"url-set-query","_rev":"4639670","name":"url-set-query","description":"small function to append a query string to a URL","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"time":{"modified":"2026-04-10T19:37:27.000Z","created":"2015-07-25T16:30:28.465Z","1.0.0":"2015-07-25T16:30:28.465Z"},"users":{},"author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"repository":{"type":"git","url":"git://github.com/mattdesl/url-set-query.git"},"versions":{"1.0.0":{"name":"url-set-query","version":"1.0.0","description":"small function to append a query string to a URL","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{},"devDependencies":{"tape":"^4.0.1"},"scripts":{"test":"node test.js"},"keywords":["query","string","url","hash","querystring","qs","browser","node","queries","uri"],"repository":{"type":"git","url":"git://github.com/mattdesl/url-set-query.git"},"homepage":"https://github.com/mattdesl/url-set-query","bugs":{"url":"https://github.com/mattdesl/url-set-query/issues"},"gitHead":"26c88abaaec85fa845890ff4d8496206c713f6e3","_id":"url-set-query@1.0.0","_shasum":"016e8cfd7c20ee05cafe7795e892bd0702faa339","_from":".","_npmVersion":"2.1.18","_nodeVersion":"0.10.32","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"016e8cfd7c20ee05cafe7795e892bd0702faa339","size":2079,"noattachment":false,"key":"/url-set-query/-/url-set-query-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/url-set-query/download/url-set-query-1.0.0.tgz"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"directories":{},"publish_time":1437841828465,"_hasShrinkwrap":false,"_cnpm_publish_time":1437841828465,"_cnpmcore_publish_time":"2021-12-16T10:12:26.534Z"}},"readme":"# url-set-query\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\nSmall standalone function to set a query string on a URL, replacing the existing query and leaving the hash in place.\n\n## Example\n\n```js\nvar setQuery = require('url-set-query')\n\nsetQuery('http://foo.com/index.html?state=open', 'beep=true')\n//=> 'http://foo.com/index.html?beep=true'\n\nsetQuery('http://foo.com/some/path#about', '?foo=5&open=true')\n//=> 'http://foo.com/some/path?foo=5&open=true#about'\n\nsetQuery('http://foo.com', 'foo=5')\n//=> 'http://foo.com/?foo=5'\n\n// clears the query\nsetQuery('http://foo.com/index.html?filter=closed#about', '?')\n//=> 'http://foo.com/index.html#about'\n```\n\n## Install\n\n```sh\nnpm install url-set-query --save\n```\n\n## Usage\n\n[![NPM](https://nodei.co/npm/url-set-query.png)](https://www.npmjs.com/package/url-set-query)\n\n#### `url = setQuery(url, [query])`\n\nAppends the given `query` String onto the URL, before the hash. If a query already exists, it will be replaced. Returns the new URL.\n\nIf `query` is `'?'`, it is the same as clearing the query string from the `url`.\n\nIf `query` is an empty string or undefined, no change will be made to `url`. \n\n## See Also\n\nTo encode/decode from an object, see one of:\n\n- [querystring](https://www.npmjs.com/package/querystring)\n- [query-string](https://www.npmjs.com/package/query-string)\n- [qs](https://www.npmjs.com/package/qs)\n\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/mattdesl/url-set-query/blob/master/LICENSE.md) for details.\n","_attachments":{},"homepage":"https://github.com/mattdesl/url-set-query","bugs":{"url":"https://github.com/mattdesl/url-set-query/issues"},"license":"MIT"}