{"id":17959475,"url":"https://github.com/ecrmnn/querystate","last_synced_at":"2026-03-18T02:35:42.319Z","repository":{"id":57332362,"uuid":"97202123","full_name":"ecrmnn/querystate","owner":"ecrmnn","description":"🔎 Simple and dependency free query string state management","archived":false,"fork":false,"pushed_at":"2020-01-14T11:07:40.000Z","size":197,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-27T08:04:26.119Z","etag":null,"topics":["query-parser","querystring","state","state-management"],"latest_commit_sha":null,"homepage":null,"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/ecrmnn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-14T06:43:48.000Z","updated_at":"2024-01-09T10:24:42.000Z","dependencies_parsed_at":"2022-09-26T16:31:17.092Z","dependency_job_id":null,"html_url":"https://github.com/ecrmnn/querystate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ecrmnn/querystate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecrmnn%2Fquerystate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecrmnn%2Fquerystate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecrmnn%2Fquerystate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecrmnn%2Fquerystate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecrmnn","download_url":"https://codeload.github.com/ecrmnn/querystate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecrmnn%2Fquerystate/sbom","scorecard":{"id":365833,"data":{"date":"2025-08-11","repo":{"name":"github.com/ecrmnn/querystate","commit":"04488c5e8d24899651f6e56456073d2e5210f5fc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 1/15 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T11:49:08.767Z","repository_id":57332362,"created_at":"2025-08-18T11:49:08.767Z","updated_at":"2025-08-18T11:49:08.767Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30642996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-18T01:41:58.583Z","status":"online","status_checked_at":"2026-03-18T02:00:07.824Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["query-parser","querystring","state","state-management"],"created_at":"2024-10-29T11:03:21.071Z","updated_at":"2026-03-18T02:35:42.283Z","avatar_url":"https://github.com/ecrmnn.png","language":"JavaScript","readme":"# querystate\n\u003e Simple and dependency free query string state management\n\n[![travis](https://img.shields.io/travis/ecrmnn/querystate/master.svg?style=flat-square)](https://travis-ci.org/ecrmnn/querystate/builds)\n[![npm version](https://img.shields.io/npm/v/querystate.svg?style=flat-square)](http://badge.fury.io/js/querystate)\n[![npm downloads](https://img.shields.io/npm/dm/querystate.svg?style=flat-square)](http://badge.fury.io/js/querystate)\n[![npm license](https://img.shields.io/npm/l/querystate.svg?style=flat-square)](http://badge.fury.io/js/querystate)\n[![prs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n[![eslint](https://img.shields.io/badge/code_style-airbnb-blue.svg?style=flat-square)](https://github.com/airbnb/javascript)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/ecrmnn/querystate/master/querystate.gif\" alt=\"querystate\"\u003e\n\u003c/p\u003e\n\n### Installation\n```bash\nnpm install querystate --save\n```\n\n### Usage\n\n#### ``all()``\nGet all parameters in the query string\n```js\n// URL: xo.com/?rainbow=awesome\u0026colors=red,blue,green\n\nconst state = require('querystate')();\n\nstate.all();\n\n//=\u003e {\n//=\u003e   rainbow: 'awesome',\n//=\u003e   colors: [\n//=\u003e     'red',\n//=\u003e     'blue',\n//=\u003e     'green',\n//=\u003e   ]\n//=\u003e }\n```\n\n#### ``get(key, [default = null])``\nGet a value from the query string by key, or a provided default.\n```js\n// URL: xo.com/?rainbow=awesome\u0026colors=red,blue,green\n\nconst state = require('querystate')();\n\nstate.get('colors');\n//=\u003e ['red', 'blue', 'green']\n\nstate.get('pony');\n//=\u003e null\n\nstate.get('wizard', 'Merlin');\n//=\u003e Merlin\n\nstate.get('wizard', () =\u003e 1 + 2 + 3 + 4);\n//=\u003e 10\n```\n\n#### ``set(key, value)``\nSet a key and value pair in to the query string\n*``set()`` will by default update the actual URL when called. This can be avoided using a config [Disable auto applying](#config)**\n```js\n// URL: xo.com/?a=b\n\nconst state = require('querystate')();\n\nstate.set('c', 'd');\n// URL: xo.com/?a=b\u0026c=d\n\nstate.all();\n\n//=\u003e {\n//=\u003e   a: 'b',\n//=\u003e   c: 'd',\n//=\u003e }\n```\n\n#### ``remove(key)``\nRemove a key and value pair in to the query string\n*``remove()`` will by default update the actual URL when called. This can be avoided using a config. [Disable auto applying](#config)*\n```js\n// URL: xo.com/?a=b\u0026c=d\n\nconst state = require('querystate')();\n\nstate.remove('c');\n// URL: xo.com/?a=b\n\nstate.all();\n\n//=\u003e {\n//=\u003e   a: 'b',\n//=\u003e }\n```\n\n#### ``toQueryString()``\nIf you want the current state as a simple query string, you can call this method\n```js\n// URL: xo.com/?a=b\n\nconst state = require('querystate')();\n\nstate.set('c', 'd');\n\nstate.toQueryString();\n//=\u003e ?a=b\u0026c=d\n```\n\n### Config\n\n#### Casts to array\nSometimes you always want your data to be in a specific way. Let's imagine we have an API where we can limit our result \nby users by providing an array of the ``user_ids`` that we want. That API endpoint always expects an array, but if we \nprovide just one user in our query string, it will get parsed to a string. But there is an easy way to always cast \nour data to an array.\n\n```js\nconst state = require('querystate')({ castsToArray: true });\n\n// URL: xo.com/?user_ids=2\nstate.get('user_id');\n//=\u003e [2]\n\nstate.all();\n//=\u003e {\n//=\u003e   user_id: [2],\n//=\u003e }\n```\n\n#### Disable auto updating of ``window.history.pushState``\nIf you want to disable auto applying state when using ``set()`` and ``remove()``, you may pass a config to ``querystate``\n```js\n// Using [window.location.search] as default state\nconst state = require('querystate')({ autoApply: false });\n\n// Custom state\nconst state = require('querystate')('?foo=bar', { autoApply: false });\n```\n\nWhen setting ``autoApply`` to ``false`` you need to explicitly tell ``querystate`` to update after a change.\n```js\n// URL: xo.com/?a=b\u0026c=d\n\nconst state = require('querystate')({ autoApply: false });\n\nstate.remove('c');\n// URL: xo.com/?a=b\u0026c=d\n\nstate.apply();\n// URL: xo.com/?a=b\n```\n\n### License\nMIT © [Daniel Eckermann](http://danieleckermann.com)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecrmnn%2Fquerystate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecrmnn%2Fquerystate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecrmnn%2Fquerystate/lists"}