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)
Use npm or yarn to install Persian Custom Hooks.
npm install persian-custom-hooks
yarn add persian-custom-hooks
- useConvertPersianToEnglish
- This hook is used to convert Persian numbers to English.
const { englishValue, convertPersianToEnglish } = useConvertPersianToEnglish();
- useFormatBankCardNumber
- This hook is used to format bank card numbers into a readable format.
const { formattedValue, formatBankCardNumber } = useFormatBankCardNumber();
- useIranianNationalCodeValidation
- This hook is used to validate Iranian national codes.
const { isValid, validateNationalCode } = useIranianNationalCodeValidation();
- useValidateBankCardNumber
- This hook is used to validate bank card number.
const { isValid, validateBankCardNumber } = useValidateBankCardNumber();
- useValidateIranianMobileNumber
- This hook is used to validate Iranian mobile number.
const { isValid, validateIranianMobileNumber } = useValidateIranianMobileNumber();
- useExtractBankCardNumber
- This hook is used to extract bank card number.
const { cardNumber, extractBankCardNumber } = useExtractBankCardNumber();
This project is released under the MIT License. For more information, see the LICENSE file.
This package is under development and we are trying to add the most useful functions