mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-19 12:10:37 +09:00
Address Greptile review fixes
This commit is contained in:
parent
269dd6abbe
commit
5de5fb507a
3 changed files with 39 additions and 22 deletions
|
|
@ -70,7 +70,16 @@ function isPlainRecord(value: unknown): value is Record<string, unknown> {
|
|||
}
|
||||
|
||||
function normalizePortablePath(input: string) {
|
||||
return input.replace(/\\/g, "/").replace(/^\.\/+/, "").replace(/^\/+/, "");
|
||||
const parts: string[] = [];
|
||||
for (const segment of input.replace(/\\/g, "/").replace(/^\.\/+/, "").replace(/^\/+/, "").split("/")) {
|
||||
if (!segment || segment === ".") continue;
|
||||
if (segment === "..") {
|
||||
if (parts.length > 0) parts.pop();
|
||||
continue;
|
||||
}
|
||||
parts.push(segment);
|
||||
}
|
||||
return parts.join("/");
|
||||
}
|
||||
|
||||
function normalizePackageFileMap(files: Record<string, string>) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue