From 0807664519274df29f4634cd112347994945c15f Mon Sep 17 00:00:00 2001 From: Unarray <48868686+Unarray@users.noreply.github.com> Date: Wed, 23 Aug 2023 15:37:16 +0200 Subject: [PATCH] Remove specific comportement from parser --- src/utils/parser/parser.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/utils/parser/parser.ts b/src/utils/parser/parser.ts index 4da4e7d..ad28a88 100644 --- a/src/utils/parser/parser.ts +++ b/src/utils/parser/parser.ts @@ -1,15 +1,13 @@ import path from "path"; import type { ExplorerEntity } from "./parser.type"; -import { escapeString } from "#/utils/regex"; import { haveChilds } from "./parser.util"; -export const filesToExplorerEntity = (files: string[], removeBasePath = "", separator: string | null = null): ExplorerEntity => { +export const filesToExplorerEntity = (files: string[], separator: string | null = null): ExplorerEntity => { separator = separator ?? path.sep; - const regex = new RegExp(`^${escapeString(removeBasePath)}`); const structure: ExplorerEntity = {}; for (const file of files) { - const parts = file.replace(regex, "").split(separator); + const parts = file.split(separator); let current = structure; for (const part of parts) {