{"id":21158228,"url":"https://github.com/simbo/path-slashes","last_synced_at":"2025-03-14T15:27:01.509Z","repository":{"id":57148561,"uuid":"330212873","full_name":"simbo/path-slashes","owner":"simbo","description":"A javascript library to add or remove trailing and/or leading slashes in path strings, test for their existence or join path strings with slashes without duplicating them.","archived":false,"fork":false,"pushed_at":"2023-05-07T23:17:18.000Z","size":493,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-05T16:08:33.140Z","etag":null,"topics":["javascript","join","leading","path","slash","slashes","string","trailing","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/simbo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2021-01-16T17:04:11.000Z","updated_at":"2023-06-13T08:17:34.000Z","dependencies_parsed_at":"2024-10-04T09:14:45.246Z","dependency_job_id":"bd5c47f1-141e-4398-80d7-d8d9f701a35b","html_url":"https://github.com/simbo/path-slashes","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simbo%2Fpath-slashes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simbo%2Fpath-slashes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simbo%2Fpath-slashes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simbo%2Fpath-slashes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simbo","download_url":"https://codeload.github.com/simbo/path-slashes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243599762,"owners_count":20317153,"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":["javascript","join","leading","path","slash","slashes","string","trailing","typescript"],"created_at":"2024-11-20T12:18:52.822Z","updated_at":"2025-03-14T15:27:01.480Z","avatar_url":"https://github.com/simbo.png","language":"TypeScript","readme":"# Path Slashes\n\n[![npm Package Version](https://img.shields.io/npm/v/path-slashes?)](https://www.npmjs.com/package/path-slashes)\n[![Package Dependencies](https://img.shields.io/badge/deps-none-4cc552)](https://www.npmjs.com/package/path-slashes?activeTab=dependencies)\n[![Coveralls github](https://img.shields.io/coveralls/github/simbo/path-slashes)](https://coveralls.io/github/simbo/path-slashes)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/simbo/path-slashes/ci.yml?branch=main)](https://github.com/simbo/path-slashes/actions/workflows/ci.yml)\n[![GitHub Repo](https://img.shields.io/badge/repo-public-87ceeb)](https://github.com/simbo/path-slashes)\n[![License MIT](https://img.shields.io/badge/license-MIT-4cc552)](http://simbo.mit-license.org/)\n\nA javascript library to add or remove trailing and/or leading slashes in path\nstrings, test for their existence or join path strings with slashes without\nduplicating them.\n\n---\n\n## Install\n\nThis package is published to the npm registry as\n[`path-slahes`](https://www.npmjs.com/package/path-slashes).\n\nYou can install it:\n\n```sh\n# using npm:\nnpm install --save path-slashes\n\n# using yarn:\nyarn add path-slashes\n```\n\nℹ️ **HINT**: This library is a pure ESM package. (You may want to\n[read this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).)\n\n## Usage Examples\n\n```js\nimport { hasLeadingSlash } from 'path-slashes';\n\n// Check if given path has a leading slash\nhasLeadingSlash('/foo'); // -\u003e true\nhasLeadingSlash('foo'); // -\u003e false\n```\n\n```js\nimport { hasTrailingSlash } from 'path-slashes';\n\n// Check if given path has a trailing slash\nhasTrailingSlash('foo/'); // -\u003e true\nhasTrailingSlash('foo'); // -\u003e false\n```\n\n```js\nimport { withLeadingSlash } from 'path-slashes';\n\n// Ensure given path has a leading slash\nwithLeadingSlash('foo'); // -\u003e '/foo'\n```\n\n```js\nimport { withTrailingSlash } from 'path-slashes';\n\n// Ensure given path has a trailing slash\nwithTrailingSlash('foo'); // -\u003e 'foo/'\n```\n\n```js\nimport { withoutLeadingSlash } from 'path-slashes';\n\n// Ensure given path has no leading slash\nwithoutLeadingSlash('/foo/'); // -\u003e 'foo/'\n```\n\n```js\nimport { withoutTrailingSlash } from 'path-slashes';\n\n// Ensure given path has no trailing slash\nwithoutTrailingSlash('/foo/'); // -\u003e '/foo'\n```\n\n```js\nimport { withSlashes } from 'path-slashes';\n\n// Ensure given path has both leading and trailing slashes\nwithSlashes('foo'); // -\u003e '/foo/'\n```\n\n```js\nimport { withoutSlashes } from 'path-slashes';\n\n// Ensure given path has neither leading nor trailing slashes\nwithoutSlashes('/foo/'); // -\u003e 'foo'\n```\n\n```js\nimport { slashJoin } from 'path-slashes';\n\n// Join path parts and add slashes where necessary\nslashJoin('foo', 'bar/', '/baz'); // -\u003e 'foo/bar/baz'\n```\n\n## API\n\n```ts\nfunction hasLeadingSlash(path: string): boolean;\n```\n\n```ts\nfunction hasTrailingSlash(path: string): boolean;\n```\n\n```ts\nfunction withLeadingSlash(path: string): string;\n```\n\n```ts\nfunction withTrailingSlash(path: string): string;\n```\n\n```ts\nfunction withSlashes(path: string): string;\n```\n\n```ts\nfunction withoutLeadingSlash(path: string): string;\n```\n\n```ts\nfunction withoutTrailingSlash(path: string): string;\n```\n\n```ts\nfunction withoutSlashes(path: string): string;\n```\n\n```ts\nfunction slashJoin(...strings: (string | string[])[]): string;\n```\n\n## License and Author\n\n[MIT \u0026copy; Simon Lepel](http://simbo.mit-license.org/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimbo%2Fpath-slashes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimbo%2Fpath-slashes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimbo%2Fpath-slashes/lists"}