UNPKG

562 BTypeScriptView Raw
1/**
2Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`.
3
4[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths.
5
6@param path - A Windows backslash path.
7@returns A path with forward slashes.
8
9@example
10```
11import path from 'node:path';
12import slash from 'slash';
13
14const string = path.join('foo', 'bar');
15// Unix => foo/bar
16// Windows => foo\\bar
17
18slash(string);
19// Unix => foo/bar
20// Windows => foo/bar
21```
22*/
23export default function slash(path: string): string;