persian-custom-hooks
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

Persian Custom Hooks

Persian Custom Hooks is a collection of custom React hooks designed for Persian-specific needs, such as converting Persian numbers to English, formatting bank card numbers, and validating Iranian national codes.

Prerequisites React 16.8 or higher (due to the use of hooks) Familiarity with TypeScript (optional but recommended)

Installation

Use npm or yarn to install Persian Custom Hooks.

npm install persian-custom-hooks
yarn add persian-custom-hooks
  1. useConvertPersianToEnglish
  • This hook is used to convert Persian numbers to English.
const { englishValue, convertPersianToEnglish } = useConvertPersianToEnglish();
  1. useFormatBankCardNumber
  • This hook is used to format bank card numbers into a readable format.
const { formattedValue, formatBankCardNumber } = useFormatBankCardNumber();
  1. useIranianNationalCodeValidation
  • This hook is used to validate Iranian national codes.
const { isValid, validateNationalCode } = useIranianNationalCodeValidation();
  1. useValidateBankCardNumber
  • This hook is used to validate bank card number.
const { isValid, validateBankCardNumber } = useValidateBankCardNumber();
  1. useValidateIranianMobileNumber
  • This hook is used to validate Iranian mobile number.
const { isValid, validateIranianMobileNumber } = useValidateIranianMobileNumber();
  1. useExtractBankCardNumber
  • This hook is used to extract bank card number.
const { cardNumber, extractBankCardNumber } = useExtractBankCardNumber();

License

This project is released under the MIT License. For more information, see the LICENSE file.

Contact Us

This package is under development and we are trying to add the most useful functions

Package Sidebar

Install

npm i persian-custom-hooks

Weekly Downloads

6

Version

1.0.8

License

MIT

Unpacked Size

15.2 kB

Total Files

16

Last publish

Collaborators

  • mojtabaone