New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@de-formed/react-validations

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@de-formed/react-validations - npm Package Compare versions

Comparing version
4.0.0
to
4.0.1
+1
-1
package.json
{
"name": "@de-formed/react-validations",
"version": "4.0.0",
"version": "4.0.1",
"description": "Modular, Function-driven Validations",

@@ -5,0 +5,0 @@ "main": "dist/index",

@@ -76,2 +76,4 @@ <p align="center">

---
### Step 2: Use the hook anywhere.

@@ -130,2 +132,30 @@

## Validation Schema
The validation schema is on object that defines a list of validation rules for
any given key. Each validation rule consists of the `error` to display to a
user and a function that returns true or false. Error messages can be passed a
function to generate dynamic error messages depending on the state of the data.
Keys that match the keys of an object will be automatically detected when using
`validateAll`.
```ts
{
email: [
{
error: 'Email is required.',
validation: ({ email }) => email.trim().length > 0,
},
{
error: ({ email }) => `${email} must be a valid email.`,
validation: ({ email, name }) =>
name === 'bob ross' ? email === 'bob.ross@gmail.com' : true
},
],
}
```
---
## Getting Started

@@ -132,0 +162,0 @@