convert windows directory slash "\" to posix directory slash "/".
import { assertEquals } from "jsr:@std/assert"// aliasing our functions for brevityconst eq = assertEquals, fn = pathToPosixPatheq(fn("C:\\Users/my name\\file.txt"), "C:/Users/my name/file.txt")eq(fn("~/path/to/file.txt"), "~/path/to/file.txt") Copy
import { assertEquals } from "jsr:@std/assert"// aliasing our functions for brevityconst eq = assertEquals, fn = pathToPosixPatheq(fn("C:\\Users/my name\\file.txt"), "C:/Users/my name/file.txt")eq(fn("~/path/to/file.txt"), "~/path/to/file.txt")
convert windows directory slash "\" to posix directory slash "/".
Example