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

Function fieldIsRequired

src/validators/index.ts:17–33  ·  view source on GitHub ↗
(
  columnDefinition: SheetColumnDefinition,
  { skipConditionCheck }: { skipConditionCheck?: boolean } = {}
)

Source from the content-addressed store, hash-verified

15import { extractReferenceColumnPossibleValues } from '../sheet/utils';
16
17export function fieldIsRequired(
18 columnDefinition: SheetColumnDefinition,
19 { skipConditionCheck }: { skipConditionCheck?: boolean } = {}
20) {
21 if (columnDefinition.validators && columnDefinition.validators.length > 0) {
22 const isRequired = columnDefinition.validators.find(
23 (v) => v.validate === 'required'
24 );
25 return (
26 isRequired != null &&
27 (skipConditionCheck
28 ? true
29 : (isRequired as RequiredValidatorDefinition).when == null)
30 );
31 }
32 return false;
33}
34
35function automaticFieldValidators(
36 columnDefinition: SheetColumnDefinition,

Callers 6

SheetDataEditorHeaderFunction · 0.90
getImporterRequirementsFunction · 0.90
validateSheetFunction · 0.85
index.test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected