{"id":17472665,"url":"https://github.com/shinnn/slash-deduplication","last_synced_at":"2026-05-05T05:38:07.907Z","repository":{"id":57362861,"uuid":"129371295","full_name":"shinnn/slash-deduplication","owner":"shinnn","description":"Deduplicate multiple consecutive slashes in a current URL without reloading a page — useful for GitHub Pages","archived":false,"fork":false,"pushed_at":"2019-01-12T10:03:37.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T13:56:00.379Z","etag":null,"topics":["cleanup","client-side","deduplication","javascript","normalization","npm-package","path","redirection","url"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shinnn.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":"2018-04-13T08:15:56.000Z","updated_at":"2019-07-08T22:06:32.000Z","dependencies_parsed_at":"2022-09-26T16:32:21.669Z","dependency_job_id":null,"html_url":"https://github.com/shinnn/slash-deduplication","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/shinnn%2Fslash-deduplication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fslash-deduplication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fslash-deduplication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinnn%2Fslash-deduplication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinnn","download_url":"https://codeload.github.com/shinnn/slash-deduplication/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245991582,"owners_count":20706129,"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":["cleanup","client-side","deduplication","javascript","normalization","npm-package","path","redirection","url"],"created_at":"2024-10-18T17:31:32.025Z","updated_at":"2026-05-05T05:38:07.877Z","avatar_url":"https://github.com/shinnn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slash-deduplication\n\n[![npm version](https://img.shields.io/npm/v/slash-deduplication.svg)](https://www.npmjs.com/package/slash-deduplication)\n[![Build Status](https://travis-ci.org/shinnn/slash-deduplication.svg?branch=master)](https://travis-ci.org/shinnn/slash-deduplication)\n[![Build status](https://ci.appveyor.com/api/projects/status/1ivou9ej9tu2obed/branch/master?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/slash-deduplication/branch/master)\n\n\u003cimg src=\"./screencast.gif\" align=\"right\" width=\"350\" /\u003e\n\nDeduplicate multiple consecutive slashes in a current URL without reloading a page\n\n## Installation\n\n[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).\n\n```\nnpm install slash-deduplication\n```\n\n## Usage\n\nOnce the HTML page loads [the script](./index.js) and if the current `location.pathname` includes multiple consecutive `/`, it [replaces](https://developer.mozilla.org/en-US/docs/Web/API/History_API#Adding_and_modifying_history_entries) the current URL with a duplicate-`/`-free one.\n\n```javascript\n(async () =\u003e {\n  location.href; //=\u003e 'https://example.org/a//b/c//d////'\n  await import('slash-deduplication');\n  location.href; //=\u003e 'https://example.org/a/b/c/d/'\n})();\n```\n\nIt only modifies the path of URL. Original fragment identifier and parameters are preserved.\n\n```javascript\n(async () =\u003e {\n  location.href; //=\u003e 'https://example.org////////page#a//b\u0026c=d//e'\n  await import('slash-deduplication');\n  location.href; //=\u003e 'https://example.org/page#a//b\u0026c=d//e'\n})();\n```\n\nThis library is suitable for static site hosting service where server-side redirection is not user-unconfigurable, for example [GitHub Pages](https://pages.github.com/).\n\n## License\n\n[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fslash-deduplication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinnn%2Fslash-deduplication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinnn%2Fslash-deduplication/lists"}