MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / buildTableFromList

Function buildTableFromList

src/lib/table-generator.ts:276–283  ·  view source on GitHub ↗
(items: T[], definitions: TableFieldDefinition<T>[])

Source from the content-addressed store, hash-verified

274 }
275
276 const buildTableFromList = <T extends object>(items: T[], definitions: TableFieldDefinition<T>[]): string => {
277 const headingLabels = definitions.map(def => getLabelFor(def))
278 const table = newOutputTable({ isList: true, head: headingLabels })
279 for (const item of items) {
280 table.push(definitions.map(def => getDisplayValueFor(item, def)))
281 }
282 return table.toString()
283 }
284
285 return { newOutputTable, buildTableFromItem, buildTableFromList }
286}

Callers

nothing calls this directly

Calls 3

getLabelForFunction · 0.85
newOutputTableFunction · 0.85
getDisplayValueForFunction · 0.85

Tested by

no test coverage detected