Convert file path to slugs.
- Typescript support
- Zero dependencies
npm i path-to-slug
For example:
toSlug("/path/to/file.ts");
toSlug("/path/to/index.ts");
Yields
["path", "to", "file"]
["path", "to"]
Backward slashes are also supported.
toSlug("path\\to\\file.ts");
ESM Only