https://github.com/fuma-nama/path-to-slug
https://github.com/fuma-nama/path-to-slug
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fuma-nama/path-to-slug
- Owner: fuma-nama
- Created: 2024-02-25T09:51:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-25T13:37:32.000Z (over 1 year ago)
- Last Synced: 2025-03-28T16:47:32.508Z (6 months ago)
- Language: TypeScript
- Size: 20.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## path-to-slug
Convert file path to slugs.
- Typescript support
- Zero dependencies```bash
npm i path-to-slug
```### Usages
For example:
```ts
toSlug("/path/to/file.ts");
toSlug("/path/to/index.ts");
```Yields
```json
["path", "to", "file"]
["path", "to"]
```### Backward Slashes
Backward slashes are also supported.
```ts
toSlug("path\\to\\file.ts");
```> ESM Only