MCPcopy
hub / github.com/brimdata/zui / isValid

Function isValid

apps/zui/src/js/models/form.ts:42–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40 const fields = () => getFields(element, config)
41 return {
42 async isValid() {
43 errors = []
44 for (const field of fields()) {
45 const check = await field.check()
46 if (!Array.isArray(check))
47 throw new Error(`${field.name} check did not return an array`)
48
49 const [passed, message] = check
50 if (!passed) errors.push(field.buildError(message))
51 }
52 return errors.length === 0
53 },
54 submit() {
55 fields().forEach((f) => f.submit())
56 },

Callers

nothing calls this directly

Calls 3

fieldsFunction · 0.85
checkMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected