From af32dbed7ff9ed7df2bfa08e6119d91e813e2a57 Mon Sep 17 00:00:00 2001 From: Superchupu <53496941+SuperchupuDev@users.noreply.github.com> Date: Sun, 29 Jun 2025 02:30:31 +0200 Subject: [PATCH] perf: use `slice` instead of `replace` when joining path --- src/api/functions/join-path.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/functions/join-path.ts b/src/api/functions/join-path.ts index efa3f81f..d103cb2c 100644 --- a/src/api/functions/join-path.ts +++ b/src/api/functions/join-path.ts @@ -9,7 +9,7 @@ export function joinPathWithBasePath(filename: string, directoryPath: string) { function joinPathWithRelativePath(root: string, options: Options) { return function (filename: string, directoryPath: string) { const sameRoot = directoryPath.startsWith(root); - if (sameRoot) return directoryPath.replace(root, "") + filename; + if (sameRoot) return directoryPath.slice(root.length) + filename; else return ( convertSlashes(relative(root, directoryPath), options.pathSeparator) +