Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 12 days 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 (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-05T16:12:13.000Z (over 4 years ago)
- Last Synced: 2024-11-22T22:36:58.652Z (29 days 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
[![tag](https://img.shields.io/github/release/justjavac/deno-slash)](https://github.com/justjavac/deno-slash/releases)
[![Build Status](https://github.com/justjavac/deno-slash/workflows/ci/badge.svg?branch=master)](https://github.com/justjavac/deno-slash/actions)
[![license](https://img.shields.io/github/license/justjavac/deno-slash)](https://github.com/justjavac/deno-slash/blob/master/LICENSE)
[![](https://img.shields.io/badge/deno-1.x-green.svg)](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).