diff --git a/src/lib/peer2.ts b/src/lib/peer2.ts index 2cf15e9..23a677a 100644 --- a/src/lib/peer2.ts +++ b/src/lib/peer2.ts @@ -114,10 +114,14 @@ export default class DIDPeer { const expanded = Object.fromEntries( Object.entries(input).map(([key, value]) => { const expandedKey = reverseCommonStringAbbreviations[key] || key - const expandedValue = - typeof value === "string" - ? reverseCommonStringAbbreviations[value] || value - : value + let expandedValue = value; + if (typeof value == "string") { + expandedValue = reverseCommonStringAbbreviations[value] || value + } else if (Array.isArray(value)) { + expandedValue = value.map((item: any) => reverseCommonStringAbbreviations[item] || item) + } else if (typeof value == "object") { + expandedValue = DIDPeer.expandCommonStringAbbreviations(expandedValue) + } return [expandedKey, expandedValue] }) ) @@ -128,10 +132,14 @@ export default class DIDPeer { const abbreviated = Object.fromEntries( Object.entries(input).map(([key, value]) => { const abbreviatedKey = commonStringAbbreviations[key] || key - const abbreviatedValue = - typeof value === "string" - ? commonStringAbbreviations[value] || value - : value + let abbreviatedValue = value + if (typeof value == "string") { + abbreviatedValue = commonStringAbbreviations[value] || value + } else if (Array.isArray(value)) { + abbreviatedValue = value.map((item: any) => commonStringAbbreviations[item] || item) + } else if (typeof value == "object") { + abbreviatedValue = DIDPeer.abbreviateCommonStrings(abbreviatedValue) + } return [abbreviatedKey, abbreviatedValue] }) ) diff --git a/src/pages/profile/compose.ts b/src/pages/profile/compose.ts index 90839e8..e8dffc4 100644 --- a/src/pages/profile/compose.ts +++ b/src/pages/profile/compose.ts @@ -25,18 +25,15 @@ export default class ComposeComponent implements m.ClassComponent { } oncreate(vnode: m.VnodeDOM<{}, this>) { - console.log("LOGGING SAMPLES", SAMPLES["Trust Ping"]) this.content = JSON.stringify(SAMPLES["Trust Ping"], null, 2) } onSampleSelected(e: Event) { - console.log((e.target as HTMLSelectElement).value) this.content = JSON.stringify( SAMPLES[(e.target as HTMLSelectElement).value], null, 2 ) - console.log(this.content) m.redraw() } diff --git a/src/pages/profile/jsoneditor.ts b/src/pages/profile/jsoneditor.ts index c41bb3f..5944eb7 100644 --- a/src/pages/profile/jsoneditor.ts +++ b/src/pages/profile/jsoneditor.ts @@ -36,9 +36,7 @@ export default class JSONEditor return m("lit-code", { language: "json", linenumbers: true, - onupdate: (e: any) => { - console.log("onupdate", e) - }, + onupdate: (e: any) => {}, }) } }