# persian-yup-ts

> Persian rules in yup

Latest version **1.0.8** (published 2024-09-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install persian-yup-ts
pnpm add persian-yup-ts
yarn add persian-yup-ts
bun add persian-yup-ts
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2024-09-06 |
| First published | 2024-06-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | AliGhaleyan |
| Maintainers | serjik |
| Keywords | yup, validation, form-validation, typescript, persian, iran, national-code, mobile-validation, telephone-validation, iban-validation, postal-code, password-confirmation, custom-yup, react, data-validation |

## Links

- npm: https://www.npmjs.com/package/persian-yup-ts
- Repository: https://github.com/AliGhaleyan/persian-yup-ts
- Issues: https://github.com/AliGhaleyan/persian-yup-ts/issues
- npm.io page: https://npm.io/package/persian-yup-ts

## Dependencies (1)

- [yup](https://npm.io/package/yup.md) ^1.4.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.8 (latest) — 2024-09-06
- 1.0.7 — 2024-09-06
- 1.0.6 — 2024-09-06
- 1.0.5 — 2024-09-03
- 1.0.4 — 2024-09-03
- 1.0.3 — 2024-09-03
- 1.0.2 — 2024-09-03
- 1.0.1 — 2024-06-12
- 1.0.0 — 2024-06-12

## README

# Persian Yup Rules

A TypeScript utility package providing custom validation rules for Persian-specific data using Yup.

## Installation

You can install the package using either Yarn or npm:

```bash
# Using Yarn
yarn add persian-yup-ts

# Or using npm
npm install persian-yup-ts
```

## Usage

To use `persian-yup-ts` in your project, follow these steps:

1. **Create a Yup utility file:**

   In your project, create a `utils/yup.ts` file and set up Yup with custom messages and rules:

   ```typescript
   import { makeYup } from "persian-yup-ts";

   const yup = makeYup({
       messages: {
           mobile: "Invalid Mobile",
           // ... add your custom messages here
       }
   });

   export default yup;
   ```

2. **Use the customized Yup instance in your forms:**

   Import the custom Yup instance in your form validation schemas:

   ```typescript jsx
   import yup from "@/utils/yup";

   const SCHEMA = yup.object({
       mobile: yup.string().mobile(),
       // ... other rules
   });
   ```

## Available Validation Rules

`persian-yup-ts` provides a set of custom validation rules tailored for Persian data formats. Here’s a list of the
available rules:

| Rule Name      | Usage Example                 | Description                                      |
|----------------|-------------------------------|--------------------------------------------------|
| `nationalCode` | `yup.string().nationalCode()` | Validates Iranian national identification codes. |
| `mobile`       | `yup.string().mobile()`       | Validates Iranian mobile phone numbers.          |
| `telephone`    | `yup.string().telephone()`    | Validates Iranian landline telephone numbers.    |
| `iban`         | `yup.string().iban()`         | Validates Iranian IBANs.                         |
| `postalCode`   | `yup.string().postalCode()`   | Validates Iranian postal codes.                  |

## License

This package is open-source and available under the MIT License.

---
_Source: https://npm.io/package/persian-yup-ts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
