New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

iramount

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iramount

enables you to create formal Farsi spoken format for numbers that represent an amount

latest
Source
npmnpm
Version
1.2.2
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source

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 :

  • @farhad

Keywords

node.js

FAQs

Package last updated on 03 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts