From a68b58df04d23de251f940cab13ee03ee10ed417 Mon Sep 17 00:00:00 2001 From: Guillermo Sagar Date: Mon, 25 Sep 2023 10:48:34 +0800 Subject: [PATCH] Update index.js Fixed the bug of determining whether it is a path under non-windows platforms. --- functions/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/index.js b/functions/index.js index 5bb809a..4b9fe70 100644 --- a/functions/index.js +++ b/functions/index.js @@ -57,8 +57,8 @@ const common_functions = { isPathRelative(path) { if(typeof path !== 'string') return false; let isAbsolute = /^([A-Za-z]:|\.)/.test(path); - - return isAbsolute; + const isLinuxPath = /^\//.test(path); + return isAbsolute||isLinuxPath; }, /** @@ -108,4 +108,4 @@ const common_functions = { } } -export { common_functions } \ No newline at end of file +export { common_functions }