{"id":16258784,"url":"https://github.com/givebest/gb-url","last_synced_at":"2026-03-16T05:32:39.826Z","repository":{"id":65422709,"uuid":"93908936","full_name":"givebest/GB-url","owner":"givebest","description":"Parse and set url search parameters.解析 、获取、设置  window.location.search （url） 参数","archived":false,"fork":false,"pushed_at":"2022-12-06T04:04:25.000Z","size":50,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-17T11:21:35.152Z","etag":null,"topics":["location","url","url-parser"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/givebest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-10T01:41:06.000Z","updated_at":"2022-12-14T22:42:53.000Z","dependencies_parsed_at":"2023-01-23T10:55:16.478Z","dependency_job_id":null,"html_url":"https://github.com/givebest/GB-url","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/givebest%2FGB-url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/givebest%2FGB-url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/givebest%2FGB-url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/givebest%2FGB-url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/givebest","download_url":"https://codeload.github.com/givebest/GB-url/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244515604,"owners_count":20464918,"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":["location","url","url-parser"],"created_at":"2024-10-10T16:00:49.014Z","updated_at":"2026-03-16T05:32:39.786Z","avatar_url":"https://github.com/givebest.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GB-url\n\nParse and set url search parameters.\n\nEnglish | [简体中文](./README.zh-CN.md)\n\n---\n\n## Introduction\n\n`queryParam` gets the value of a parameter in `window.location.search` or a string that matches the rule.  \n`setParams` sets the value of one or more parameters in `window.location.search` or a string that matches the rule, and returns `[url]?p1=1\u0026p2=2\u0026p3=3`.\n\n## Use\n\n```bash\nnpm i gb-url\n```\n\n```js\nimport { setParams, queryParam } from \"gb-url\";\n```\n\n### Get URL parameter\n\n```javascript\n/**\n * gbUrl.queryParam(key, url);\n * @param  key [Name of the parameter to get]\n * @param  url [The URL to be resolved or a string that matches the rule, default is window.location.href]\n **/\n\nconst url = \"a.html?a=1\u0026b=2\u0026c=3\";\nqueryParam(\"a\", url); // 1\nqueryParam(\"b\", url); // 2\n```\n\n### Set URL parameters\n\n```javascript\n/**\n * gbUrl.setParams(params, url);\n * @param  params [Object to be set, assigned (key,value)]\n * @param  url [The URL to be resolved or a string that matches the rule, default is window.location.href]\n **/\n\nconst url = \"a.html?a=1\u0026b=2\u0026c=3\";\nsetParams(\n  {\n    a: \"11111\",\n  },\n  url\n); // \"a.html?a=11111\u0026b=2\u0026c=3\"\n\nsetParams(\n  {\n    b: \"2222\",\n    c: \"3333\",\n    d: \"4444\",\n  },\n  url\n); // \"a.html?a=1\u0026b=2222\u0026c=3333\u0026d=4444\"\n```\n\n## License\n\n[MIT](./LICENSE) © 2022 [givebest](https://github.com/givebest)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgivebest%2Fgb-url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgivebest%2Fgb-url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgivebest%2Fgb-url/lists"}