()
| 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 | }, |