@sustainhawaii/heal-schemas
v3.27.4
Published
schemas and validators for healthies collections
Downloads
158
Keywords
Readme
#heal-schemas
Functions
validate(schemaOrPath, val, [options]) ⇒ object
Returns true if yup validates, false if error.
Kind: global function
Returns: object - Plain object containing error and value keys.
If validation passes, value is the cleaned up value.
If validation fails, errors is a plain object
| Param | Type | Default | Description | | --- | --- | --- | --- | | schemaOrPath | object | string | | yup schema object or dot-notation path to one in schemas | | val | * | | The value to validate against the schema | | [options] | object | | |
isValid(schemaOrPath, val, [logger]) ⇒ boolean
Returns true if yup validates, false if error.
Kind: global function
| Param | Type | Description | | --- | --- | --- | | schemaOrPath | object | string | yup schema object or dot-notation path to one in schemas | | val | * | The value to validate against the schema | | [logger] | function | If included, and validation fails, log errors with this function. |
throwIfInvalid(value, schema) ⇒ Promise.<void>
Throw an error if value does not match schema.
Kind: global function
| Param | Type | Description | | --- | --- | --- | | value | * | value to validate against supplied schema | | schema | object | yup schema | | [] | string | errorMessage |