invalid
function invalid(issue): Invalid;The answer of a facet check when the value is refused. The change that carried the value fails. You return it from the validate function of ctx.facets.define.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
issue |
{ code: string; message: string; path?: string; } |
code (a short name), message (what the person reads) and, if you want, path (where in the value the problem is) |
issue.code |
string |
- |
issue.message |
string |
- |
issue.path? |
string |
- |
Returns
Section titled “Returns”{ invalid: issue }
Example
Section titled “Example”validate: value => (typeof value === 'number' ? valid() : invalid({ code: 'not-a-number', message: 'Minutes must be a number' }))