{"id":13528329,"url":"https://github.com/ghostery/url-parser","last_synced_at":"2025-05-13T20:33:07.424Z","repository":{"id":43000228,"uuid":"194833147","full_name":"ghostery/url-parser","owner":"ghostery","description":"A fast typescript implementation of the window.URL API","archived":false,"fork":false,"pushed_at":"2024-10-17T11:28:42.000Z","size":2438,"stargazers_count":24,"open_issues_count":12,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-02T08:08:23.078Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghostery.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2019-07-02T09:31:36.000Z","updated_at":"2024-10-17T11:28:46.000Z","dependencies_parsed_at":"2024-10-20T12:47:11.618Z","dependency_job_id":null,"html_url":"https://github.com/ghostery/url-parser","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostery%2Furl-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostery%2Furl-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostery%2Furl-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghostery%2Furl-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghostery","download_url":"https://codeload.github.com/ghostery/url-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254021434,"owners_count":22000917,"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-08-01T06:02:25.902Z","updated_at":"2025-05-13T20:33:07.106Z","avatar_url":"https://github.com/ghostery.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Ghostery Url Parser\n\nA Fast implementation of url parsing, mostly API-compatible with the standard URL class while\nbeing on average 2-3 times faster. Evaluation of URL components is lazy, so this implementation\nshould be fast for all read use-cases.\n\nKnown differences to standard URL:\n * Parameters returned via `URL.searchParams.entries()` are decoded only with\n   `decodeURIComponent`. This differs to standards parsing in some subtle ways.\n * You can iterate a URL parameters array directly via `URL.searchParams.params`. This is around\n   20% faster than using an iterator.\n * Parameter strings (`;` sepearated key/value pairs) are parsed, and accessible via `URL.parameters`.\n * Domain parsing with [tldts](https://github.com/remusao/tldts) is built in. The `URL.domainInfo` attribute returns output from tldts'\n   `parseHost` method.\n * Hostname validation is not done on initial parse. The `isValidHost()` method is provided for\n   this purpose.\n * All URLs with a valid authority are given an `origin`, regardless of the protocol scheme. This differs from the [standard](https://url.spec.whatwg.org/#origin) that only does so for a set of known schemes.\n\n## Install\n\n```bash\nnpm install @ghostery/url-parser\n```\n\n## Usage\n\n```javascript\nconst parsed = new URL('https://www.example.com');\nparsed.hostname // == 'www.example.com'\n```\n\n## Performance\n\nWe benchmark against a list of 250,000 URLs collected from popular sites, as previously used in our\n[adblocker benchmark](https://whotracks.me/blog/adblockers_performance_study.html). We compare\ntwo use-cases:\n 1. `URL` object creation: `new URL(url)`\n 2. Query string parsing: `new URL(url).searchParams.entries()`\n\nWe compare to a reference implementation on each platform:\n * Node: `URL` class from the `url` library\n * Firefox: `window.URL`\n * Chrome: `window.URL`\n * Safari: `window.URL`\n\n| Environment | Use case | Reference: urls/s | Ghostery parser: urls/s | Speedup |\n| --- | --- | --: | --: | --- |\n| Node 11 | `new URL()` | `149,514` | `1,577,711` | _10.5x faster_\n| Node 11 | `searchParams` | `140,544` | `198,340` | _1.4x faster_\n| Firefox 69 | `new URL()` | `268,066` | `1,043,877` | _3.9x faster_\n| Firefox 69 | `searchParams` | `119,207` | `354,793` | _3.0x faster_\n| Chrome 75 | `new URL()` | `366,294` | `1,721,903` | _4.7x faster_\n| Chrome 75 | `searchParams` | `144,309` | `283,956` | _2.0x faster_\n| Safari 12 |  `new URL()` | `656,930` | `1,525,078` | _2.3x faster_\n| Safari 12 | `searchParams` | `264,481` | `437,738` | _1.7x faster_\n\nAll benchmarks were run on a Mid 2015 Macbook Pro, 2.5 GHz Intel Core i7, 16GB.\n\n## License\n\n[Mozilla Public License 2.0](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghostery%2Furl-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghostery%2Furl-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghostery%2Furl-parser/lists"}