Fix process undefined error in browsers.

This commit is contained in:
saul 2023-03-28 13:04:08 +13:00
parent 06a68bbe1c
commit 3c79588778

View File

@ -3,7 +3,7 @@ const win32Reg = /((?<=\\)\\+)|(^\.\\)|((?<=\\)\.\\)/g
const createJoin = isWin => (...paths) => paths.join(isWin ? '\\' : '/').replace(isWin ? win32Reg : posixReg, '')
export const join = createJoin(process?.platform === 'win32')
export const join = createJoin(typeof process !== 'undefined' && process?.platform === 'win32')
export const posixJoin = createJoin(false)
export const win32Join = createJoin(true)