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

Function normalizeItem

shell/plugins/menu/MenuModel.js:13–39  ·  view source on GitHub ↗
(id, raw)

Source from the content-addressed store, hash-verified

11}
12
13function normalizeItem(id, raw) {
14 var value = raw || {}
15 var aliases = normalizeAliases(value.aliases)
16 var parent = value.parent
17 if (parent === undefined)
18 parent = id.indexOf(".") >= 0 ? id.split(".").slice(0, -1).join(".") : "root"
19 if (id === "root") parent = ""
20
21 var kind = value.action ? "action" : (value.target ? "link" : "menu")
22
23 return {
24 id: id,
25 parent: parent,
26 kind: kind,
27 icon: value.icon || "",
28 iconFont: value.iconFont || "",
29 label: value.label || id,
30 title: value.title || "",
31 target: value.target || "",
32 description: value.description || "",
33 action: value.action || "",
34 provider: value.provider || "",
35 aliases: aliases,
36 when: value.when || "",
37 checked: value.checked || ""
38 }
39}
40
41function parseMenuJsonc(raw) {
42 var stripped = stripJsonc(raw)

Callers 1

parseMenuJsoncFunction · 0.85

Calls 1

normalizeAliasesFunction · 0.85

Tested by

no test coverage detected