MCPcopy Create free account
hub / github.com/cifertech/DisplayKit / inferSizeFromPath

Function inferSizeFromPath

app.js:2668–2683  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

2666}
2667
2668function inferSizeFromPath(file) {
2669 const raw = String(file || "").replace(/\\/g, "/");
2670 const parts = raw.split("/").filter(Boolean);
2671 // Look for a folder like "16x16" / "32x32"
2672 for (const part of parts) {
2673 const m = part.match(/^(\d+)x(\d+)$/i);
2674 if (m) {
2675 const w = parseInt(m[1], 10);
2676 const h = parseInt(m[2], 10);
2677 if (Number.isFinite(w) && Number.isFinite(h) && w > 0 && h > 0) {
2678 return { w, h, tag: `${w}x${h}` };
2679 }
2680 }
2681 }
2682 return null;
2683}
2684
2685function safeSymbolFromPath(path) {
2686 const raw = String(path || "").replace(/\\/g, "/");

Callers 4

loadFileIconsFunction · 0.85
addIconElementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected