Socket
Socket
Sign inDemoInstall

@hookform/resolvers

Package Overview
Dependencies
Maintainers
3
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hookform/resolvers - npm Package Compare versions

Comparing version 2.6.1 to 2.7.0

typanion/dist/index.d.ts

20

package.json
{
"name": "@hookform/resolvers",
"amdName": "hookformResolvers",
"version": "2.6.1",
"description": "React Hook Form validation resolvers: Yup, Joi, Superstruct, Zod, Vest, Class Validator, io-ts, Nope and computed-types",
"version": "2.7.0",
"description": "React Hook Form validation resolvers: Yup, Joi, Superstruct, Zod, Vest, Class Validator, io-ts, Nope, computed-types and Typanion",
"main": "dist/resolvers.js",

@@ -72,2 +72,8 @@ "module": "dist/resolvers.module.js",

},
"./typanion": {
"browser": "./typanion/dist/typanion.module.js",
"umd": "./typanion/dist/typanion.umd.js",
"import": "./typanion/dist/typanion.mjs",
"require": "./typanion/dist/typanion.js"
},
"./package.json": "./package.json",

@@ -104,3 +110,6 @@ "./": "./"

"computed-types/src",
"computed-types/dist"
"computed-types/dist",
"typanion/package.json",
"typanion/src",
"typanion/dist"
],

@@ -123,2 +132,3 @@ "publishConfig": {

"build:computed-types": "microbundle --cwd computed-types --globals '@hookform/resolvers=hookformResolvers'",
"build:typanion": "microbundle --cwd typanion --globals '@hookform/resolvers=hookformResolvers'",
"postbuild": "node ./config/node-13-exports.js",

@@ -146,3 +156,4 @@ "lint": "eslint . --ext .ts,.js --ignore-path .gitignore",

"nope",
"computed-types"
"computed-types",
"typanion"
],

@@ -192,2 +203,3 @@ "repository": {

"ts-jest": "^27.0.1",
"typanion": "^3.3.2",
"typescript": "^4.3.2",

@@ -194,0 +206,0 @@ "vest": "^3.2.3",

50

README.md

@@ -23,2 +23,6 @@ <div align="center">

## Links
- [React-hook-form validation resolver documentation ](https://react-hook-form.com/api/useform/#validationResolver)
## API

@@ -159,3 +163,4 @@

const schema = Joi.object({
username: Joi.string().required(),
name: Joi.string().required(),
age: Joi.number().required(),
});

@@ -377,4 +382,3 @@

username: string.min(1).error('username field is required'),
password: string.min(1).error('password field is required'),
password: number,
age: number,
});

@@ -405,2 +409,42 @@

### [typanion](https://github.com/arcanis/typanion)
Static and runtime type assertion library with no dependencies
[![npm](https://img.shields.io/bundlephobia/minzip/typanion?style=for-the-badge)](https://bundlephobia.com/result?p=typanion)
```tsx
import React from 'react';
import { useForm } from 'react-hook-form';
import { typanionResolver } from '@hookform/resolvers/typanion';
import * as t from 'typanion';
const isUser = t.isObject({
username: t.applyCascade(t.isString(), [t.hasMinLength(1)]),
age: t.applyCascade(t.isNumber(), [t.isInteger(), t.isInInclusiveRange(1, 100)]),
});
const App = () => {
const {
register,
handleSubmit,
formState: { errors },
} = useForm({
resolver: typanionResolver(isUser),
});
return (
<form onSubmit={handleSubmit((d) => console.log(d))}>
<input {...register('name')} />
{errors.name?.message && <p>{errors.name?.message}</p>}
<input type="number" {...register('age')} />
{errors.age?.message && <p>{errors.age?.message}</p>}
<input type="submit" />
</form>
);
};
export default App;
```
## Backers

@@ -407,0 +451,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc