{"id":13760189,"url":"https://github.com/anonrig/url-js","last_synced_at":"2025-04-12T21:09:21.620Z","repository":{"id":40450936,"uuid":"465069696","full_name":"anonrig/url-js","owner":"anonrig","description":"Super fast spec-compliant URL state machine for Node.js","archived":false,"fork":false,"pushed_at":"2023-10-07T11:25:31.000Z","size":459,"stargazers_count":165,"open_issues_count":2,"forks_count":5,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-04-12T21:09:18.708Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/url-state-machine","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/anonrig.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2022-03-01T21:57:44.000Z","updated_at":"2024-10-01T19:40:10.000Z","dependencies_parsed_at":"2024-01-02T23:30:25.619Z","dependency_job_id":null,"html_url":"https://github.com/anonrig/url-js","commit_stats":{"total_commits":143,"total_committers":2,"mean_commits":71.5,"dds":0.006993006993006978,"last_synced_commit":"246237cb41d1864c01d139ee6635ec61575bbe26"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anonrig%2Furl-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anonrig%2Furl-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anonrig%2Furl-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anonrig%2Furl-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anonrig","download_url":"https://codeload.github.com/anonrig/url-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631676,"owners_count":21136562,"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-03T13:01:05.089Z","updated_at":"2025-04-12T21:09:21.600Z","avatar_url":"https://github.com/anonrig.png","language":"JavaScript","readme":"## URL State Machine\n\nSuper fast specification compliant URL state machine for Node.js. For more information about the URL parsing state machine visit [here](https://url.spec.whatwg.org/#url-parsing).\n\n### Installation\n\n```bash\nnpm i --save url-state-machine\n```\n\n### Usage\n\n```javascript\nconst URLStateMachine = require('url-state-machine')\nconst state = new URLStateMachine('https://www.yagiz.co/implementing-node-js-url-parser-in-webassembly-with-rust')\n\nconsole.log(state.url)\n// {\n//   scheme: 'https',\n//   username: '',\n//   password: '',\n//   host: 'www.yagiz.co',\n//   port: null,\n//   path: [ 'implementing-node-js-url-parser-in-webassembly-with-rust' ],\n//   query: null,\n//   fragment: null\n// }\n```\n\n### Benchmarks\n\n\u003cdetails\u003e\n  \u003csummary\u003eFull domain with input and base\u003c/summary\u003e\n\n- `new URL(\"/path/to/something?hello=world\", \"https://www.google.com\")`\n\n```\n╔═══════════════════╤═════════╤══════════════════╤═══════════╤══════════════════════════╗\n║ Slower tests      │ Samples │           Result │ Tolerance │ Difference with previous ║\n╟───────────────────┼─────────┼──────────────────┼───────────┼──────────────────────────╢\n║ whatwg-url        │    1000 │  37994.48 op/sec │  ± 0.97 % │                          ║\n║ url-state-machine │    9500 │ 257195.34 op/sec │  ± 0.99 % │ + 576.93 %               ║\n╟───────────────────┼─────────┼──────────────────┼───────────┼──────────────────────────╢\n║ Fastest test      │ Samples │           Result │ Tolerance │ Difference with previous ║\n╟───────────────────┼─────────┼──────────────────┼───────────┼──────────────────────────╢\n║ URL               │   10000 │ 477303.34 op/sec │  ± 1.27 % │ + 85.58 %                ║\n╚═══════════════════╧═════════╧══════════════════╧═══════════╧══════════════════════════╝\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eipv4 address\u003c/summary\u003e\n\n- `new URL(\"http://127.0.0.1\")`\n\n```\n╔═══════════════════╤═════════╤═══════════════════╤═══════════╤══════════════════════════╗\n║ Slower tests      │ Samples │            Result │ Tolerance │ Difference with previous ║\n╟───────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢\n║ whatwg-url        │    5000 │   91747.56 op/sec │  ± 0.97 % │                          ║\n║ url-state-machine │   10000 │  626208.74 op/sec │  ± 1.65 % │ + 582.53 %               ║\n╟───────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢\n║ Fastest test      │ Samples │            Result │ Tolerance │ Difference with previous ║\n╟───────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢\n║ URL               │    2500 │ 1037903.40 op/sec │  ± 0.87 % │ + 65.74 %                ║\n╚═══════════════════╧═════════╧═══════════════════╧═══════════╧══════════════════════════╝\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eipv6 address\u003c/summary\u003e\n\n- `new URL(\"http://[1:0::]\")`\n\n```\n╔═══════════════════╤═════════╤═══════════════════╤═══════════╤══════════════════════════╗\n║ Slower tests      │ Samples │            Result │ Tolerance │ Difference with previous ║\n╟───────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢\n║ whatwg-url        │    5500 │  196896.91 op/sec │  ± 0.97 % │                          ║\n║ url-state-machine │   10000 │ 1321601.39 op/sec │  ± 2.76 % │ + 571.21 %               ║\n╟───────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢\n║ Fastest test      │ Samples │            Result │ Tolerance │ Difference with previous ║\n╟───────────────────┼─────────┼───────────────────┼───────────┼──────────────────────────╢\n║ URL               │    8000 │ 1356561.74 op/sec │  ± 0.97 % │ + 2.65 %                 ║\n╚═══════════════════╧═════════╧═══════════════════╧═══════════╧══════════════════════════╝\n```\n\u003c/details\u003e\n\n### Testing\n\n#### Running\n\nAll tests are referenced and borrowed from [web-platform-tests](https://github.com/web-platform-tests/wpt/blob/master/url/resources/urltestdata.json).\n\n```bash\nnpm test\n```\n\n#### Code Coverage\n\n```\nTest Files  1 failed (1)\n     Tests  1 failed | 732 passed (733)\n      Time  633ms (in thread 64ms, 989.58%)\n```\n\nFile          | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s\n--------------|---------|----------|---------|---------|--------------------------------------------\nAll files     |   95.88 |    95.18 |      98 |   95.88 |\n constants.js |     100 |      100 |     100 |     100 |\n encoding.js  |     100 |      100 |     100 |     100 |\n index.js     |   93.99 |    93.02 |     100 |   93.99 | ...4-775,800-801,921-922,926-927,1070-1071\n parser.js    |   99.53 |    99.05 |     100 |   99.53 | 283-284\n platform.js  |     100 |      100 |     100 |     100 |\n string.js    |     100 |      100 |     100 |     100 |\n utf8.js      |   84.33 |    88.23 |      50 |   84.33 | 39-44,63-64,77-81\n\n#### Conformance to specification\n\n- pathname\n  - 1 failed | 732 passed (733)\n- search\n  - 1 failed | 732 passed (733)\n- host\n  - 733 passed (733)\n- password\n  - 733 passed (733)\n- protocol\n  - 733 passed (733)\n- username\n  - 733 passed (733)\n- port\n  - 733 passed (733)\n- fragment\n  - 733 passed (733)\n","funding_links":[],"categories":["String","JavaScript"],"sub_categories":["Runner"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanonrig%2Furl-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanonrig%2Furl-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanonrig%2Furl-js/lists"}