{"id":19094421,"url":"https://github.com/risto-stevcev/url-parser-combinator","last_synced_at":"2026-05-26T00:30:25.005Z","repository":{"id":57387604,"uuid":"52624705","full_name":"Risto-Stevcev/url-parser-combinator","owner":"Risto-Stevcev","description":":telescope: A proper url parser and combinator that works with eulalie","archived":false,"fork":false,"pushed_at":"2016-02-27T16:56:07.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-03T04:37:14.570Z","etag":null,"topics":["combinator","parser","url"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/url-parser-combinator","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/Risto-Stevcev.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}},"created_at":"2016-02-26T18:36:30.000Z","updated_at":"2017-08-07T09:55:33.000Z","dependencies_parsed_at":"2022-09-26T16:50:52.484Z","dependency_job_id":null,"html_url":"https://github.com/Risto-Stevcev/url-parser-combinator","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Risto-Stevcev%2Furl-parser-combinator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Risto-Stevcev%2Furl-parser-combinator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Risto-Stevcev%2Furl-parser-combinator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Risto-Stevcev%2Furl-parser-combinator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Risto-Stevcev","download_url":"https://codeload.github.com/Risto-Stevcev/url-parser-combinator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240144102,"owners_count":19754849,"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":["combinator","parser","url"],"created_at":"2024-11-09T03:29:03.080Z","updated_at":"2026-05-26T00:30:24.872Z","avatar_url":"https://github.com/Risto-Stevcev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# url-parser-combinator\n\n[![Build Status](https://travis-ci.org/Risto-Stevcev/url-parser-combinator.svg)](https://travis-ci.org/Risto-Stevcev/url-parser-combinator)\n\nA proper url parser and combinator that works with [eulalie](https://github.com/bodil/eulalie).\n\n\n## Usage\n\n```javascript\nconst parser = require('url-parser-combinator')\n\nvar goodUrl = parser.parse('http://localhost:80/foo/bar?key1=value1\u0026key2=value2')\n// 'http://localhost:80/foo/bar?key1=value1\u0026key2=value2'\n\nvar badUrl = parser.parse('//foo//bar')\n// ''\n```\n\nOr you can feed the `parser.URL` combinator into eulalie to parse a url.\n\n\n## Implementation\n\nThe parser is an implementation of the BNF form for URLs based on the [RFC 1808 spec](http://www.ietf.org/rfc/rfc1808.txt).\n\nAll of the BNF rules in the RFC spec are provided to you as combinators, which means that you can use this library to get partial aspects of a url, such as `relativeURL`, `params`, or `query`, or create your own custom combinator from the components. For example, the library accepts relative and absolute urls, but you can use the provided `absoluteURL` combinator to make a parser that consumes only absolute urls.\n\nYou can also use the `URL` combinator as part of another parser. For example, in the eulalie readme there is simple parser for an HTTP request. You could use this combinator in conjunction with this example to make the parser validate that the `path` is a proper url rather than just an arbitrary string:\n\n```javascript\nconst URL = require('url-parser-combinator').URL\n\nconst parser = p.seq(function*() {\n  const {value: method} = yield p.many1(p.upper);\n  yield p.spaces1;\n  const {value: path} = yield URL;  // *Parse a URL*\n  yield p.spaces1;\n  yield p.string(\"HTTP/\");\n  const {value: version} = yield p.seq(function*() {\n    const {value: left} = yield p.many1(p.digit);\n    yield p.char(\".\");\n    const {value: right} = yield p.many1(p.digit);\n    return `${left}.${right}`;\n  });\n  return {method, path, version};\n});\n```\n\n## License\nLicensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fristo-stevcev%2Furl-parser-combinator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fristo-stevcev%2Furl-parser-combinator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fristo-stevcev%2Furl-parser-combinator/lists"}