MCPcopy
hub / github.com/agent0ai/agent-zero / normalizePath

Function normalizePath

plugins/_editor/webui/editor-preview.js:194–206  ·  view source on GitHub ↗
(path = "")

Source from the content-addressed store, hash-verified

192}
193
194function normalizePath(path = "") {
195 const absolute = String(path || "").startsWith("/");
196 const parts = [];
197 for (const part of String(path || "").split("/")) {
198 if (!part || part === ".") continue;
199 if (part === "..") {
200 parts.pop();
201 continue;
202 }
203 parts.push(part);
204 }
205 return `${absolute ? "/" : ""}${parts.join("/")}`;
206}
207
208function escapeHtml(value = "") {
209 return String(value || "")

Callers 1

Calls 3

popMethod · 0.80
pushMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected