DEV Community

Joodi
Joodi

Posted on

Convert Numbers to Persian with the ToPersianNumber Library

If you're working on React.js or Next.js projects and need to display numbers in Persian format, the ToPersianNumber library is exactly what you need! This simple, lightweight, and effective library converts English numbers into Persian numerals with ease, allowing you to enhance the user experience for Persian-speaking audiences.

Image description

Why ToPersianNumber?

Simple and Lightweight: This library does just one thing—converts English numbers to Persian—and it does it perfectly. No extra complexity, no bloat.

Perfect for React.js and Next.js Projects: Easily integrate this library into your React and Next.js apps.

Fast and Efficient: While simple, it performs its job quickly and accurately, making it ideal for any project that requires number localization.

How to Use**

  1. Install the library using npm:
npm install topersiannumber
Enter fullscreen mode Exit fullscreen mode

Or using Yarn:

yarn add topersiannumber
Enter fullscreen mode Exit fullscreen mode
  1. Import and use it in your project:
import { ToPersianNumber } from 'topersiannumber';

// Converting a number
const persianFormattedNumber = ToPersianNumber(123456); // Outputs: ١٢٣٤٥٦
console.log(persianFormattedNumber);

Enter fullscreen mode Exit fullscreen mode

Your Support Means a Lot!
This is my first library, and I’d really appreciate your support! Feel free to star the repo and share it with others who might find it useful.

You can find the full repository here.

📦 Check it out on npm 📦

Happy coding! 🚀

Top comments (0)