stylelint
Version:
A mighty CSS linter that helps you avoid errors and enforce conventions.
15 lines (12 loc) • 390 B
JavaScript
import { posix, win32 } from 'node:path';
const REPEATED_SLASHES = /(?<!^)\/+/g;
/**
* Convert backslashes to forward slashes and collapse repeated slashes,
* except the leading double slash of a UNC path
*
* @param {string} path
* @returns {string}
*/
export default function toUnixPath(path) {
return path.replaceAll(win32.sep, posix.sep).replace(REPEATED_SLASHES, posix.sep);
}