true-email-validator
Advanced tools
Comparing version 1.0.0-alpha.4 to 1.0.0-alpha.5
{ | ||
"name": "true-email-validator", | ||
"version": "1.0.0-alpha.4", | ||
"version": "1.0.0-alpha.5", | ||
"description": "A fully RFC 5322 and RFC 6531/6532 compliant email address validator.", | ||
@@ -5,0 +5,0 @@ "main": "dist/true-email-validator.cjs", |
@@ -106,4 +106,4 @@ # true-email-validator | ||
| options.noNonASCIILocalPart | `boolean` | If true, then disallows non-ASCII/international characters in the username/local part of the address. | | ||
| options.validateInput | `function` | A function to perform additional, arbitrary validation on a syntactically valid input string. This function is provided mainly to support input validation libraries where the input is not recoverable from the processed value. In general, users should prefer `validateResult`. The result of `validateInput` should be either `true` or a string describing the issue. Any value which is not a string nor literal `true` is treated as invalidating the input and a generic message is provided. | | ||
| options.validateResult | `function` | A function to perform additional, arbitrary validation on a syntactically valid email address result. The function should expect a single [`EmailData`](#EmailData) argument which is the result off all other build in validations and any `validateInput` result (`validateResult` is the last check performed). If the input was not recognized as an email address to begin with, then `validateResult` is not invoked.. The function may: 1) return `true`, in which case no change is made to the `EmailData` result and it is returned to the user as is, 2) return `false`, in which case a generic "result validation failed" message is added to the `EmailData` `issues` and the original `EmailData` is returned to the user, 3) return a string, in which case the string is appended to the `EmailData` `issues` field and the original `EmailData` is returned to the user, 4) modify the `EmailData` argument directly and either return it or return 'undefined `, which are equivalent and will result in the input `EmailData` being returned as the function result; in this case, if there is an issue `EmailData` `isValid` should be set false and an issue appended; if the validation function is overriding an originally invalid result, then `isValid` should be set true and the `issues` truncated, 5) create a new `EmailData` result object and return it; here again, the `validateResult` function is responsible for setting `isValid` and updating `issues` according to the results of the validation. | | ||
| options.validateInput | `function` | A function to perform additional, arbitrary validation on a syntactically valid input string. This function is provided mainly to support input validation libraries where the input is not recoverable from the processed value. In general, users should prefer `validateResult`. The inputs two the function are the input string and the original options to this function. The function must return `true` if the validation check passes. Any other result is indicative of failure. If the result is a string, then that is understood to be a description of the problem and it's pushed onto the `EmailData` `issues` list. Otherwise, a generic 'custom validation failed' message is pushed onto the `issues` list. | | ||
| options.validateResult | `function` | A function to perform additional, arbitrary validation on a syntactically valid email address result. The function should expect two arguments: [`EmailData`](#EmailData) argument which is the result off all other built in validations and any `validateInput` result (`validateResult` is the last check performed) and a second argument which is the options originally passed into this func. Note, if the input was not recognized as an email address to begin with, then `validateResult` is not invoked. The function may return a modified or replacement [`EmailData`](#EmailData) object (any object defining the required fields is recognized as an `EmailData` result object). In this case, the function is responsible for setting `EmailData` `isValid` and `issues` fields as appropriate. Otherwise, a return value of `true` is taken to indicate the validation succeeded. Any other value is treated as a value and `isValid` will be set to `false`. If the result is a string, thin it's understood as a description of the issue and is pushed to the `issues` list. Otherwise, a generic 'custom validation failed' message is pushed to the `issues` list. | | ||
@@ -113,3 +113,3 @@ **Returns**: [`EmailData`](#EmailData) - The results of the validation. | ||
[**Source code**](./src/lib/validate-email.mjs#L121) | ||
[**Source code**](./src/lib/validate-email.mjs#L118) | ||
@@ -116,0 +116,0 @@ <a id="EmailData"></a> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
404919
534