t-comm
Version:
专业、稳定、纯粹的工具库
19 lines (16 loc) • 398 B
JavaScript
import { isWindows } from '../validate/validate.mjs';
/**
* 格式化路径
* @param path 文件路径,或目录路径
* @returns 格式化后的路径
* @example
* ```ts
* normalizePath('xxx/xxx/xxx');
*
* normalizePath('xxx\\xxx\\xxx');
* ```
*/
var normalizePath = function normalizePath(path) {
return isWindows() ? path.replace(/\\/g, '/') : path;
};
export { normalizePath };