GithubHelp home page GithubHelp logo

iramount's Introduction

number to persian text converter

This NodeJs library enables you to create formal Farsi spoken format for numbers that represent an amount in Rials (IRR).

install

using npm :

$ npm install iramount --save

Usage

const irAmount = require("iramount"); 
const amount = new irAmount(10239876); // constructor just accepts number 

Grouping Digits

To group digits by three, use

const withDigitGrouping = amount.digitGrouped(); // returns 10,239,876

params :

  • formatType | default = "R" | R = Rial and T = Toman
  • language | default = "EN" | EN = English and Fa = Farsi
  • groupDigitBy | default = 3
  • amount | constructor value

for Ex :

const withDigitGrouping = amount.digitGrouped("R", "Fa"); // returns ۱۰,۲۳۹,۸۷۶

or

const withDigitGrouping = amount.digitGrouped("T", "Fa", 2); // returns ۱,۰۲,۳۹,۸۷.۶

Convert To Text

To display Farsi spoken format in Rials (IRR), use

const rialFormat = amount.farsiFormatRial(); // returns ده میلیون و دویست و سی و نه هزار و هشتصد و هفتاد و شش ریال

To display Farsi spoken format in Tomans (Toman), use

const tomanFormat = amount.farsiFormatToman(); // returns یک میلیون و بیست و سه هزار و نهصد و هشتاد و هفت تومان
// showRial option to show Rials ...
const tomanFormat = amount.farsiFormatToman({ showRial: true }); // returns یک میلیون و بیست و سه هزار و نهصد و هشتاد و هفت تومان و شش ریال

special thanks :

iramount's People

Contributors

farzad-845 avatar nimah79 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.