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

Function areAllRequiredMappingsSet

src/mapper/utils.ts:188–207  ·  view source on GitHub ↗
(
  sheetDefinitions: SheetDefinition[],
  mappings: ColumnMapping[]
)

Source from the content-addressed store, hash-verified

186}
187
188export function areAllRequiredMappingsSet(
189 sheetDefinitions: SheetDefinition[],
190 mappings: ColumnMapping[]
191) {
192 for (const sheet of sheetDefinitions) {
193 for (const column of sheet.columns) {
194 if (fieldIsRequired(column) && allowUserToMapColumn(column)) {
195 const mapping = mappings.find(
196 (m) => m.sheetId === sheet.id && m.sheetColumnId === column.id
197 );
198
199 if (mapping == null) {
200 return false;
201 }
202 }
203 }
204 }
205
206 return true;
207}

Callers 1

HeaderMapperFunction · 0.90

Calls 2

fieldIsRequiredFunction · 0.90
allowUserToMapColumnFunction · 0.85

Tested by

no test coverage detected