vuelidify 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -406,7 +406,7 @@ There aren't many validators provided by this library on purpose. If you feel a
|
|
|
406
406
|
# Custom Validators
|
|
407
407
|
This section guides you to create your own generic validators. Validators were designed to be easy to create and easier to use.
|
|
408
408
|
|
|
409
|
-
Here is a breakdown of one of the
|
|
409
|
+
Here is a breakdown of one of the provided validators (expanded to make comments more readable):
|
|
410
410
|
|
|
411
411
|
```ts
|
|
412
412
|
// always provide a header comment to explain what the validator does!
|
|
@@ -438,8 +438,8 @@ export function isEmailSync<
|
|
|
438
438
|
// Strongly type the expected params object to have intellisense
|
|
439
439
|
params: ValidatorParams<T, K, V, A>
|
|
440
440
|
) => {
|
|
441
|
-
// you can do whatever
|
|
442
|
-
//
|
|
441
|
+
// you can do whatever a normal function can do here.
|
|
442
|
+
// However, you must return undefined, an array of validators, or a validation result.
|
|
443
443
|
// In this case, we're checking the value of the property against an email regex.
|
|
444
444
|
return {
|
|
445
445
|
isValid: params.value ? RegExp(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/).test(params.value) : false,
|