MCPcopy Create free account
hub / github.com/HelloCSV/HelloCSV / getColumnDisplayValue

Function getColumnDisplayValue

src/utils/index.ts:162–197  ·  view source on GitHub ↗
(
  sheetDefinition: SheetDefinition,
  columnDefinition: SheetColumnDefinition,
  value: ImporterOutputFieldType,
  enumLabelDict: EnumLabelDict
)

Source from the content-addressed store, hash-verified

160}
161
162export function getColumnDisplayValue(
163 sheetDefinition: SheetDefinition,
164 columnDefinition: SheetColumnDefinition,
165 value: ImporterOutputFieldType,
166 enumLabelDict: EnumLabelDict
167): ImporterOutputFieldType {
168 if (columnDefinition.type === 'enum') {
169 return getLabelDictValue(
170 enumLabelDict[sheetDefinition.id]?.[columnDefinition.id] ?? {},
171 value
172 );
173 }
174
175 if (columnDefinition.type === 'reference' && value != null) {
176 return getLabelDictValue(
177 getLabelDict(columnDefinition, enumLabelDict),
178 value
179 );
180 }
181
182 if (columnDefinition.type === 'boolean') {
183 if (value === true) {
184 return (
185 columnDefinition.typeArguments?.trueLabel ?? DEFAULT_BOOLEAN_TRUE_LABEL
186 );
187 }
188 if (value === false) {
189 return (
190 columnDefinition.typeArguments?.falseLabel ??
191 DEFAULT_BOOLEAN_FALSE_LABEL
192 );
193 }
194 }
195
196 return value;
197}
198
199export function getSubmittedSheetData(
200 sheets: SheetDefinition[],

Callers 2

getCellDisplayValueFunction · 0.90
generateCsvContentFunction · 0.85

Calls 2

getLabelDictValueFunction · 0.85
getLabelDictFunction · 0.85

Tested by

no test coverage detected