https://github.com/justjavac/deno-slash
Convert Windows backslash paths to slash paths
https://github.com/justjavac/deno-slash
deno deno-mod deno-module javascript
Last synced: 3 months ago
JSON representation
Convert Windows backslash paths to slash paths
- Host: GitHub
- URL: https://github.com/justjavac/deno-slash
- Owner: justjavac
- License: mit
- Created: 2019-11-30T03:33:05.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-05T16:12:13.000Z (almost 5 years ago)
- Last Synced: 2025-03-03T14:51:18.757Z (4 months ago)
- Topics: deno, deno-mod, deno-module, javascript
- Language: TypeScript
- Size: 6.84 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# deno-slash
[](https://github.com/justjavac/deno-slash/releases)
[](https://github.com/justjavac/deno-slash/actions)
[](https://github.com/justjavac/deno-slash/blob/master/LICENSE)
[](https://github.com/denoland/deno)> Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`
[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters.
This was created since the `path` methods in Node.js outputs `\\` paths on Windows.
## Usage
```js
import { slash } from "https://deno.land/x/slash/mod.ts";slash("foo\\bar");
// Unix => foo/bar
// Windows => foo/bar
```## API
### slash(path)
Type: `string`
Accepts a Windows backslash path and returns a path with forward slashes.
## Thanks
Heavily inspired by [sindresorhus/slashh](https://github.com/sindresorhus/slash).