{"id":15503191,"url":"https://github.com/johno/normalize_url","last_synced_at":"2025-12-11T23:36:54.554Z","repository":{"id":62430088,"uuid":"45643875","full_name":"johno/normalize_url","owner":"johno","description":"Elixir package to normalize urls","archived":false,"fork":false,"pushed_at":"2019-02-11T16:18:30.000Z","size":26,"stargazers_count":3,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T07:47:55.613Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://hexdocs.pm/normalize_url/","language":"Elixir","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/johno.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":"2015-11-05T22:36:42.000Z","updated_at":"2023-09-01T12:08:29.000Z","dependencies_parsed_at":"2022-11-01T20:07:33.271Z","dependency_job_id":null,"html_url":"https://github.com/johno/normalize_url","commit_stats":null,"previous_names":["johnotander/normalize_url"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johno%2Fnormalize_url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johno%2Fnormalize_url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johno%2Fnormalize_url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johno%2Fnormalize_url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johno","download_url":"https://codeload.github.com/johno/normalize_url/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250338505,"owners_count":21414199,"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-10-02T09:12:26.937Z","updated_at":"2025-12-11T23:36:54.521Z","avatar_url":"https://github.com/johno.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# normalize_url [![Build Status](https://travis-ci.org/johnotander/normalize_url.svg?branch=master)](https://travis-ci.org/johnotander/normalize_url)\n\n[Normalize](https://en.wikipedia.org/wiki/URL_normalization) a url. This is useful for displaying, storing, sorting, etc.\n\n## Installation\n\nAdd :normalize_url to your list of dependencies in `mix.exs`\n\n```elixir\ndef deps do\n  [{:normalize_url, \"~\u003e 0.0.2\"}]\nend\n```\n\nEnsure :normalize_url is started before your application\n\n```elixir\ndef application do\n  [applications: [:normalize_url]]\nend\n```\n\n## Usage\n\n```elixir\nNormalizeUrl.normalize_url(\"https://www.google.com?b=b\u0026a=a\")\n# =\u003e \"https://google.com?a=a\u0026b=b\"\n\nNormalizeUrl.normalize_url(\"//foo.bar#about\")\n# =\u003e \"http://foo.bar\"\n```\n\n#### Options\n\n##### strip_www\n\nType: `boolean`   \nDefault: `true`\n\nRemove `www.` from the url\n\n```elixir\nNormalizeUrl.normalize_url(\"http://www.johnotander.com\")\n# =\u003e \"http://johnotander.com\"\n\nNormalizeUrl.normalize_url(\"http://www.johnotander.com\", [strip_www: false])\n# =\u003e \"http://www.johnotander.com\"\n```\n\n##### strip_fragment\n\nType: `boolean`   \nDefault: `true`\n\nRemove `#framents` from the url\n\n```elixir\nNormalizeUrl.normalize_url(\"http://johnotander.com#about.html\")\n# =\u003e \"http://johnotander.com\"\n\nNormalizeUrl.normalize_url(\"http://www.johnotander.com\", [strip_fragment: false])\n# =\u003e \"http://johnotander.com#about.html\"\n```\n\n##### :normalize_protocol\n\nType: `boolean`   \nDefault: `true`\n\nNormalize relative protocols\n\n```elixir\nNormalizeUrl.normalize_url(\"//johnotander.com#about\")\n# =\u003e \"http://johnotander.com\"\n\nNormalizeUrl.normalize_url(\"//www.johnotander.com\", [normalize_protocol: false])\n# =\u003e \"//johnotander.com\"\n```\n\n##### add_root_path\n\nType: `boolean`   \nDefault: `false`\n\nAdds a trailing slash for the root path, if the path is empty.\n\n```elixir\nNormalizeUrl.normalize_url(\"http://example.com\")\n# =\u003e \"http://example.com\"\n\nNormalizeUrl.normalize_url(\"http://example.com\", [add_root_path: true])\n# =\u003e \"http://example.com/\"\n```\n\n## Development\n\n```\nmix test\n```\n\n## Related\n\n* Elixir port from the [`normalize-url`](https://github.com/sindresorhus/normalize-url) node module by [Sindre Sorhus](https://github.com/sindresorhus).\n\n## License\n\nMIT\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\nCrafted with \u003c3 by [John Otander](http://johnotander.com) ([@4lpine](https://twitter.com/4lpine)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohno%2Fnormalize_url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohno%2Fnormalize_url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohno%2Fnormalize_url/lists"}