{"id":13451839,"url":"https://github.com/lukeed/qss","last_synced_at":"2025-10-09T18:24:48.968Z","repository":{"id":45069559,"uuid":"107940612","full_name":"lukeed/qss","owner":"lukeed","description":"A tiny (294b) browser utility for encoding \u0026 decoding a querystring.","archived":false,"fork":false,"pushed_at":"2023-03-10T01:59:28.000Z","size":31,"stargazers_count":444,"open_issues_count":5,"forks_count":17,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-28T18:15:59.874Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukeed.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"lukeed"}},"created_at":"2017-10-23T06:26:30.000Z","updated_at":"2024-10-28T08:22:33.000Z","dependencies_parsed_at":"2024-07-31T07:13:46.300Z","dependency_job_id":"12794757-8041-4754-9b64-0869330c8691","html_url":"https://github.com/lukeed/qss","commit_stats":{"total_commits":52,"total_committers":4,"mean_commits":13.0,"dds":0.05769230769230771,"last_synced_commit":"4d3699a0711c1879e89cd86433b1badaea5db1da"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fqss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fqss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fqss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fqss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukeed","download_url":"https://codeload.github.com/lukeed/qss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245158398,"owners_count":20570177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T07:01:04.308Z","updated_at":"2025-10-09T18:24:43.933Z","avatar_url":"https://github.com/lukeed.png","language":"JavaScript","funding_links":["https://github.com/sponsors/lukeed"],"categories":["JavaScript","Routers and URL Utils"],"sub_categories":["Reactive Programming"],"readme":"# qss [![Build Status](https://travis-ci.org/lukeed/qss.svg?branch=master)](https://travis-ci.org/lukeed/qss)\n\n\u003e A tiny (305B) browser utility for stringifying a query Object.\n\nYou should only consider using this within a browser context since Node's built-in [`querystring.stringify`](https://nodejs.org/api/querystring.html#querystring_querystring_stringify_obj_sep_eq_options) is [much faster](#benchmarks) and _should be_ used in a Node environment! An ideal use case is serializing a query object before an API request is sent.\n\nThis module exposes three module definitions:\n\n* **ES Module**: `dist/qss.mjs`\n* **CommonJS**: `dist/qss.js`\n* **UMD**: `dist/qss.min.js`\n\n\n## Install\n\n```\n$ npm install --save qss\n```\n\n\n## Usage\n\n```js\nimport { encode, decode } from 'qss';\n\nencode({ foo:'hello', bar:[1,2,3], baz:true });\n//=\u003e 'foo=hello\u0026bar=1\u0026bar=2\u0026bar=3\u0026baz=true'\n\nencode({ foo:123 }, '?');\n//=\u003e '?foo=123'\n\nencode({ bar:'world' }, 'foo=hello\u0026');\n//=\u003e 'foo=hello\u0026bar=world'\n\ndecode('foo=hello\u0026bar=1\u0026bar=2\u0026bar=3\u0026baz=true');\n//=\u003e { foo:'hello', bar:[1,2,3], baz:true };\n```\n\n\n## API\n\n### qss.encode(params, prefix)\nReturns: `String`\n\nReturns the formatted querystring.\n\n#### params\nType: `Object`\n\nThe object that contains all query parameter keys \u0026 their values.\n\n#### prefix\nType: `String`\u003cbr\u003e\nDefault: `''`\n\nAn optional prefix. The stringified `params` will be appended to this value, so it must end with your desired joiner; eg `?`.\n\n\u003e **Important:** No checks or validations will run on your `prefix`. Similarly, no character is used to \"glue\" the query string to your `prefix` string.\n\n### qss.decode(query)\nReturns: `Object`\n\nReturns an Object with decoded keys and values.\n\nRepetitive keys will form an Array of its values. Also, `qss` will attempt to typecast `Boolean` and `Number` values.\n\n#### query\nType: `String`\n\nThe query string, without its leading `?` character.\n\n```js\nqss.decode(\n  location.search.substring(1) // removes the \"?\"\n);\n```\n\n\n## Benchmarks\n\n\u003e Running Node v10.13.0\n\n***Encode***\n\n```\nqss             x 1,112,341 ops/sec ±0.24% (96 runs sampled)\nnative          x 5,303,246 ops/sec ±0.76% (95 runs sampled)\nquerystringify  x   950,501 ops/sec ±0.76% (96 runs sampled)\nquery-string    x   347,603 ops/sec ±1.05% (92 runs sampled)\nqs              x   733,449 ops/sec ±0.62% (97 runs sampled)\n```\n\n***Decode***\n\n```\nqss             x   443,667 ops/sec ±0.17% (95 runs sampled)\nnative          x   189,194 ops/sec ±0.44% (94 runs sampled)\nquerystringify  x   282,169 ops/sec ±0.26% (96 runs sampled)\nquery-string    x   191,334 ops/sec ±0.71% (95 runs sampled)\nqs              x   168,165 ops/sec ±0.41% (93 runs sampled)\n```\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fqss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukeed%2Fqss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fqss/lists"}