Add path joining utility.

This commit is contained in:
saul
2023-03-28 12:16:42 +13:00
parent edb913a0ed
commit cf421ee669

4
src/utils/path-join.js Normal file
View File

@@ -0,0 +1,4 @@
const s = process?.platform === 'win32' ? '\\' : '/'
const reg = new RegExp(`((?<=\\${s})\\${s}+)|(^\\.\\${s})|((?<=\\${s})\\.\\${s})`, 'g')
export default (...paths) => paths.join(s).replace(reg, '')