用于转换 Windows 反斜杠路径转换为正斜杠路径

https://github.com/sindresorhus/slash

npm install slash

 

import path from 'path';
import slash from 'slash';

const string = path.join('foo', 'bar');
// Unix    => foo/bar
// Windows => foo\\bar

slash(string);
// Unix    => foo/bar
// Windows => foo/bar

 

posted @ 2022-01-20 17:08  云卷芸舒  阅读(445)  评论(0)    收藏  举报