MCPcopy Create free account
hub / github.com/basecamp/omarchy / resolveRoute

Function resolveRoute

shell/plugins/menu/MenuModel.js:176–190  ·  view source on GitHub ↗
(items, itemOrder, input)

Source from the content-addressed store, hash-verified

174// (htop ships `Keywords=system;...`). Unknown strings fall through as the
175// literal input so misspellings still attempt to open that id.
176function resolveRoute(items, itemOrder, input) {
177 var raw = String(input || "").toLowerCase().replace(/_/g, "-")
178 if (!raw || raw === "go" || raw === "menu") return "root"
179 if (item(items, raw)) return raw
180 var order = Array.isArray(itemOrder) ? itemOrder : []
181 for (var i = 0; i < order.length; i++) {
182 var entry = item(items, order[i])
183 if (!entry || entry.kind === "app" || !entry.aliases) continue
184 for (var j = 0; j < entry.aliases.length; j++) {
185 var alias = String(entry.aliases[j] || "").toLowerCase().replace(/_/g, "-")
186 if (alias === raw) return entry.id
187 }
188 }
189 return raw
190}
191
192function slugify(value) {
193 return String(value || "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "item"

Callers

nothing calls this directly

Calls 1

itemFunction · 0.85

Tested by

no test coverage detected